欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

opencv(六):图像拼接

程序员文章站 2022-05-16 10:37:14
...
import numpy as np
import cv2
from cv2 import Stitcher

if __name__ == "__main__":
    img1 = cv2.imread('jj.jpg')

    img2 = cv2.imread('gg.jpg')
    stitcher = cv2.createStitcher(False)
    # stitcher = cv2.Stitcher.create(cv2.Stitcher_PANORAMA), 根据不同的OpenCV版本来调用
    (_result, pano) = stitcher.stitch((img1, img2))
    pano = cv2.resize(pano,(600,400))
    print(pano)
    cv2.imshow('pano',pano)
    cv2.waitKey(0)
    cv2.destroyAllWindows()