代码
import cv2 as cv
def main():
stitcher = cv.createStitcher(False)
img1 = cv.imread(r'pin1.jpg')
img2 = cv.imread(r'pin2.jpg')
result = stitcher.stitch((img1,img2))
cv.imshow("pinjie1",img1)
cv.imshow("pinjie2",img2)
cv.imshow("win",result[1])
cv.waitKey(0)
cv.destroyAllWindows()
cv.imwrite("result.jpg", result[1])
if __name__ == "__main__":
main()