失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 【opencv-python 使用stitcher.stitch进行全景的拼接】将多张图片拼接成全景 采用了stitcher.stitch

【opencv-python 使用stitcher.stitch进行全景的拼接】将多张图片拼接成全景 采用了stitcher.stitch

时间:2019-09-27 08:49:04

相关推荐

【opencv-python 使用stitcher.stitch进行全景的拼接】将多张图片拼接成全景 采用了stitcher.stitch

效果

左边两张为拼接前,右边为拼接后

关键函数

stitcher = cv2.Stitcher.create()

(status,res) =stitcher.stitch(imglist)

代码

import osimport cv2imgdir = 'fullview'imgnamelist = os.listdir(imgdir)print(imgnamelist)imglist=[]for imgmane in imgnamelist:path = imgdir+'/'+imgmaneimg = 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)

如果觉得《【opencv-python 使用stitcher.stitch进行全景的拼接】将多张图片拼接成全景 采用了stitcher.stitch》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。