利用OpenCV实现全景拼接

import  cv2
import  os

mainFolder = 'image'
myFolders = os.listdir(mainFolder)
print(myFolders)

for folder in myFolders:
    path = mainFolder + '/' + folder
    image =[]
    myList = os.listdir(path)
    print(f'Total no of images detected{len(myList)}')
    for imgN in myList:
        curImg = cv2.imread(f'{path}/{imgN}')
        curImg = cv2.resize(curImg,(0,0),None,0.2,0.2)
        image.append(curImg)

    stitcher = cv2.Stitcher.create()
    (status,result) = stitcher.stitch(image)
    if (status == cv2.STITCHER_OK):
        print("success")
    else:
        print('unsuccess')

你可能感兴趣的:(opencv实战小项目,opencv,计算机视觉,人工智能)