左边两张为拼接前,右边为拼接后
代码stitcher = cv2.Stitcher.create()
(status,res) =stitcher.stitch(imglist)
import os
import cv2
imgdir = 'fullview'
imgnamelist = os.listdir(imgdir)
print(imgnamelist)
imglist=[]
for imgmane in imgnamelist:
path = imgdir+'/'+imgmane
img = cv2.imread(path)
#对图片进行缩放
img = cv2.resize(img,(0,0),None,0.5,0.5)
cv2.imshow(imgmane,img)
cv2.waitKey(1)
imglist.append(img)
stitcher = cv2.Stitcher.create()
(status,res) = stitcher.stitch(imglist)
if(status == cv2.STITCHER_OK):
print('successful')
cv2.imshow('res',res)
else:
print('fail')
cv2.waitKey(0)



