Opencv 使用缝合器模块缝合图像时的尺寸问题
我尝试使用OpenCV中的缝合器模块来缝合图像。下面是我的代码核心部分Opencv 使用缝合器模块缝合图像时的尺寸问题,opencv,image-stitching,opencv-stitching,Opencv,Image Stitching,Opencv Stitching,我尝试使用OpenCV中的缝合器模块来缝合图像。下面是我的代码核心部分 int main() { Mat img1 = imread("5.jpg"); Mat img2 = imread("6.jpg"); //Mat img3 = imread("11.jpg"); imgs.push_back(img1); imgs.push_back(img2); //imgs.push_back(img3); Mat pano; // Mat
int main()
{
Mat img1 = imread("5.jpg");
Mat img2 = imread("6.jpg");
//Mat img3 = imread("11.jpg");
imgs.push_back(img1);
imgs.push_back(img2);
//imgs.push_back(img3);
Mat pano; // Mat to store the output pano image
Stitcher stitcher = Stitcher::createDefault(try_use_gpu); // create a Stitcher object
Stitcher::Status status = stitcher.stitch(imgs, pano); // stitch the input images together
cout << "hello" <<endl;
if (status != Stitcher::OK)
{
cout << "Can't stitch images, error code = " << int(status) << endl;
return -1;
}
imshow("pano",pano);
imwrite(result_name, pano); // write the result to the output image
waitKey(0);
return 0;
}
上面代码中的imgs是Mat类型的向量
我在网上看到了很多类似的代码,但我不知道为什么我的代码对输入图像的大小有很大的限制。如果输入图像大小在800*600左右,则效果良好。但当大小为650*650或1280*640或其他值时,控制台提示将在程序结束后很快关闭。并且没有图像保存在panosult.jpg中。也不显示任何图像。Visual Studio 2010正在显示图像_stitching2.exe:Native已退出,代码为-1 0xffffffff。当我调试的时候
有人能帮忙吗?我真的需要在这方面取得进展,因为我已经花了几个小时来修复它,但只是不正确。任何提示或帮助对我都很好