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

不言
Release: 2018-04-27 15:46:44
Original
5150 people have browsed it

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')
Copy after login

Save matrix as picture

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!