import cv2
import numpy as np
import glob
path_1='C:/Users/Akash/Downloads/good/images/*.jpg'
path_2='C:/Users/Akash/Downloads/good/labels/*.jpg'
num_1=1
num_2=1
for file1 in glob.glob(path_1):
for file2 in glob.glob(path_2):
if(file1==file2):
img1 = cv2.imread(file1)
img2 = cv2.imread(file2)
dest_and = cv2.bitwise_and(img2, img1, mask = None)
cv2.imwrite('C:/Users/Akash/Downloads/single_folder/output_images/image_'+str(num_1)+'.jpg', dest_and)
num_1 +=1
num_2 +=1
I want to add 50 images from one folder to its corresponding 50 images from another folder with same filename in Python.
How can I work around the problem?