3

I try to use a different way for stitching images, but I got the following error...I try to change the format of the images or the size but nothing happens...any ideas?

error:

Error: Assertion failed (imgs.size() == imgs_.size()) in unknown function, file ......\src\opencv\modules\stitching\src\stitcher.cpp , line 128

my code:

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);
 }
billz
  • 44,644
  • 9
  • 83
  • 100
Malin
  • 231
  • 3
  • 8
  • Why do you have so many unused variables? BTW, check if your `imread`s are actually successful. It could be, for example, that you are trying to load some jpg images without jpg support enabled in OpenCV. [Here](http://stackoverflow.com/a/12854400/2436175) you find an example on how to check if the image has been loaded correctly. – Antonio Apr 01 '15 at 20:20

2 Answers2

1

This is because estimateTransform() is not able to stitch all the images you have provided. You can check how many images were stitched using Stitcher::component(), it returns a vector of ints, which size is your goal. Therefore, in your case its size should be 2 if the stitching was successful.

0

The question is similiar to this one:

using compose panorama without estimateTransform

I've just answered you there.

Community
  • 1
  • 1
Finfa811
  • 618
  • 1
  • 8
  • 28