You use it correctly, for some reason the process was unsuccessful.
The first value of the result tuple is the error code, with 0 indicating success. Here you get 1, which means, according to stitching.hpp , that the process needs more images.
enum Status { OK = 0, ERR_NEED_MORE_IMGS = 1, ERR_HOMOGRAPHY_EST_FAIL = 2, ERR_CAMERA_PARAMS_ADJUST_FAIL = 3 };
ERR_NEED_MORE_IMGS usually indicates that there are not enough key points in your images.
If you need more information about the cause of the error, you can switch to C ++ and debug the process in detail.
Edit: providing a working example
The same code as the OP just added result persistence and absolute paths.
import cv2 stitcher = cv2.createStitcher(False) foo = cv2.imread("D:/foo.png") bar = cv2.imread("D:/bar.png") result = stitcher.stitch((foo,bar)) cv2.imwrite("D:/result.jpg", result[1])
with these images: (hope you like pandas)
foo.png

bar.png

result.jpg

source share