OpenCV Stitching

时间:2012-11-03 08:12:34

标签: c++ opencv image-stitching panoramas

我非常需要opencv拼接模块的帮助。我需要使用" stitch"来创建全景摄影。 opencv中的方法。下面是我到目前为止...但是当我运行程序时,我收到此错误:需要更多图像。是否有OpenCV专家可以帮我解决这个错误?

IplImage* img1 = cvLoadImage("/Users/myName/Desktop/image1.jpg", CV_LOAD_IMAGE_COLOR);
IplImage* img2 = cvLoadImage("/Users/myName/Desktop/image2.jpg", CV_LOAD_IMAGE_COLOR);

Mat vecImg1 = img1;
Mat vecImg2 = img2;

Mat allImages;

allImages.push_back(vecImg1);
allImages.push_back(vecImg2);

Mat outputImage;
Stitcher stitchImg = Stitcher::createDefault();
Stitcher::Status s = stitchImg.stitch(allImages, outputImage);
cout << "status: " << s << endl;

cvNamedWindow("stitch images", CV_WINDOW_AUTOSIZE);
cvShowImage("stitch images", &outputImage);
cvWaitKey(0);
cvDestroyWindow("stitch images");

3 个答案:

答案 0 :(得分:4)

我猜“allImages”的类型应为vector<Mat>

查看OpenCV样本“samples / cpp / stitching.cpp”。

答案 1 :(得分:0)

我实际上找到了一条路。

在Xcode中,在Build Settings下,我将编译器类型从Apple LLVM更改为LLVM GCC 4.2,现在我的代码生成全景图像就好了!

谢谢!

答案 2 :(得分:0)

在stitcher类函数中,opencv find功能匹配图像。如果您输入的图像没有共同的特征或非常少的特征,则不会将这些图像视为同一视图的图像 因此需要更多图像