0

How to save multiple images to a folder?

This code can only save one picture in the folder import cv2 import glob from skimage.filters import gaussian from skimage import img_as_ubyte from skimage import io from skimage.filters import unsharp_mask path = "C:/Users/dell/.jupyter/images/normal/*.*" img_number = 1 for file in glob.glob(path): img = cv2.imread(file,0) unsharped_img = img_as_ubyte(unsharp_mask(img, radius=5, amount=2)) cv2.imwrite("C:/Users/dell/.jupyter/images/smoothed/.jpg"+str(img_number)+".jpg",unsharped_img) import matplotlib.pyplot as plt fig = plt.figure(figsize=(4,4)) ax1 = fig.add_subplot(1,2,1) ax1 . imshow(img,cmap='gray') ax1.title.set_text('original image') ax2 = fig.add_subplot(1,2,2) ax2 . imshow(unsharped_img,cmap='gray') ax2.title.set_text('unsharped image') plt.show() img_number +=1

27th Aug 2021, 2:34 AM
Luqman khan
Luqman khan - avatar
2 Answers
0
Can someone help
27th Aug 2021, 2:34 AM
Luqman khan
Luqman khan - avatar
0
Luqman khan try using loop
27th Aug 2021, 3:14 AM
Pariket Thakur
Pariket Thakur - avatar