Home >Backend Development >Python Tutorial >How to read pictures in batches in python
The first step is to open the shell interface of Python language, which is idle.
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
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'
The fourth step is to use the following instructions to read our pictures in batches. The code is as follows:
coll = io.ImageCollection(str)
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))
If we want to display one of our pictures, we can use the following instructions to process it:
io.imshow(coll[10]) io.show()
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!