python中的多图像拼接

2024-04-16 23:43:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试运行一个在Windows上使用opencv缝合器模块的图像缝合代码。在

这里有一个代码:

import cv2
import numpy as np
import glob

images = []

for file in glob.glob("path_to_images/*.png"):
    n= cv2.imread(file)
    images.append(n)

result = images[0]   
for i in images:
    stitcher = cv2.createStitcher(False)
    result = stitcher.stitch(result, images[i])
    cv2.imwrite("C:/Users/user/Desktop/mosaicing/island/out1.jpg", result[1])

我收到一个错误: TypeError:只有整数标量数组才能转换为标量索引

如果您能给我一些关于如何解决这个问题的提示,我将不胜感激。TIA公司


Tags: 模块代码in图像importforwindowsresult