In this video, we will use the Python "glob" module to load images from folders and subfolders. The glob is an in-built module in Python, and comes with Python installation. So you don't need to install it separately.
First, we import glob and use glob.glob() function to read all the image paths from nested folders, i.e. folders, and subfolders.
Complete program in Python is as follows:
import glob
from PIL import Image
import matplotlib.pyplot as plt
image_paths = glob.glob('./**/*.jpg', recursive=True)
plt.figure(figsize=(10, 10))
for index, image_path in enumerate(image_paths):
#print(image_path)
image = Image.open(image_path)
plt.subplot(5, 5, index + 1) # Change grid size as needed
plt.imshow(image) # Display the image
plt.axis('off') # Hide the axis for each image
Show all images in the grid
plt.tight_layout()
plt.show()
Python Videos
1. • How to Install Python (3.13.0) on Windows ...
2. • Install Jupyter Notebook on Windows 11 and...
Computer vision & image processing related videos:
1. • How to load and visualize CIFAR-10 and CIF...
2. • How to load and visualize multiple images ...
Playlists
• Python Tutorial for Beginners
• Colab
• Computer Vision
In questa pagina del sito puoi guardare il video online How to load multiple images from folder and subfolder using Python della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Binary Study 29 gennaio 2025, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 710 volte e gli è piaciuto 3 spettatori. Buona visione!