合成全景图不起作用

Compose panorama doesn`t work

本文关键字:不起作用 全景 成全      更新时间:2023-10-16

我试图使用不同的方法来拼接图像,但我得到了以下错误。。。我试图更改图像的格式或大小,但什么也没发生。。。有什么想法吗?

错误:

错误:断言失败(imgs.size()==imgs_.size(())在未知函数中,文件。。。。。。\src\opencv\modules\stitche\src\sttitcher.cpp,第128行

我的代码:

int main( int argc, char** argv )
{

 Stitcher stitcher = Stitcher::createDefault();
 Mat image11,image22;
 Mat pano,output_frame;
 vector<Mat> imgs,currentFrames;
// Load the images
 Mat image1= imread( argv[1] );
 Mat image2= imread( argv[2] );
 printf("-- umwandlung works");
currentFrames.push_back(image1);
currentFrames.push_back(image2);
stitcher.estimateTransform( currentFrames );
stitcher.composePanorama(currentFrames, output_frame );

 waitKey(0);
 }

这是因为estimateTransform()无法缝合您提供的所有图像。您可以使用Stitcher::component()检查缝合了多少图像,它返回一个int向量,该向量的大小是您的目标。因此,在您的情况下,如果缝合成功,其尺寸应为2。

这个问题类似于这个问题:

使用合成全景而不进行估计变换

我刚刚在那里回答了你。