# load the two images and resize them to have a width of 400 pixels # (for faster processing) if (i == 2 or (nbrVerticalImages == 2 and i == 0)): n = j - 1 first = file + "/" + str(n) + "." + formatImage imageA = cv2.imread(first) second = file + "/" + str(j) + "." + formatImage imageB = cv2.imread(second) imageA = imutils.resize(imageA, width=400) imageB = imutils.resize(imageB, width=400) # stitch the images together to create a panorama stitcher = Stitcher() (result, vis) = stitcher.stitch_horizontal([imageA, imageB], showMatches=True) elif i != 1: imageA = result second = file + "/" + str(j) + "." + formatImage imageB = cv2.imread(second) imageB = imutils.resize(imageB, width=400) # stitch the images together to create a panorama stitcher = Stitcher() (result, vis) = stitcher.stitch_horizontal([imageA, imageB], showMatches=True) if interm: # show the images cv2.imshow("Image A", imageA)