Home > Backend Development > Python Tutorial > How to read pictures in batches in python

How to read pictures in batches in python

爱喝马黛茶的安东尼
Release: 2019-08-02 15:16:36
Original
10001 people have browsed it

How to read pictures in batches in python

The first step is to open the shell interface of Python language, which is idle.

How to read pictures in batches in python

The second step is to load the toolkit to be used. The code is as follows:

import skimage.io as io
from skimage import data_dir
Copy after login

How to read pictures in batches in python

Related recommendations: "Python Video Tutorial"

The third step is to set the path where the image is located. The path in the article uses the directory of the file in the library. The code is as follows:

str=data_dir + '/*.png'
Copy after login

How to read pictures in batches in python

The fourth step is to use the following instructions to read our pictures in batches. The code is as follows:

coll = io.ImageCollection(str)
Copy after login

How to read pictures in batches in python

In fact, our documents exist in coll, you can To see how many pictures there are in our article, use the following code:

print(len(coll))
Copy after login

How to read pictures in batches in python

If we want to display one of our pictures, we can use the following instructions to process it:

io.imshow(coll[10])
io.show()
Copy after login

How to read pictures in batches in python

How to read pictures in batches in python

The above is the detailed content of How to read pictures in batches in python. 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