Home>Article>Backend Development> Python method to read image files into matrices and save matrices into images

Python method to read image files into matrices and save matrices into images

不言
不言 Original
2018-04-27 15:46:44 5108browse

The following is a Python method for reading image files into matrices and saving matrices into images. It has a good reference value and I hope it will be helpful to everyone. Come and take a look together

Read the picture into a matrix

import matplotlib im = matplotlib.image.imread('0_0.jpg')

Save matrix as picture

import numpy as np import scipy x = np.random.random((600,800,3)) scipy.misc.imsave('meelo.jpg', x)

Related recommendations:

Python3 medium How to read txt data files into the matrix

#

The above is the detailed content of Python method to read image files into matrices and save matrices into images. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn