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

How to read pictures in batches in python

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-02 15:16:369990browse

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

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'

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)

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))

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()

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!

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