0

I desperately need help with the opencv stitching module. I need to create a panoramic photography using the "stitch" method in opencv. Below is what I have so far.. but when I run the program I get this error: Need more images. Is there an OpenCV expert who can help me with this error?

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");
Andro Selva
  • 53,910
  • 52
  • 193
  • 240
hsyforw
  • 26
  • 1
  • 2

3 Answers3

4

I guess "allImages" should be of type vector<Mat>.

Check out OpenCV sample "samples/cpp/stitching.cpp".

luhb
  • 656
  • 5
  • 4
1

I actually found a way around.

In Xcode, under the Build Settings, I changed the Compiler type from Apple LLVM to LLVM GCC 4.2 and now my code generates panorama image just fine!

Thanks!

hsyforw
  • 26
  • 1
  • 2
0

In the stitcher class function, opencv find feature matches between images. If the image you have entered have no or very less features in common, it will not treat these images as image of same view Hence more images required

Garvita Tiwari
  • 584
  • 2
  • 12