2

I try to use compose panorama without estimateTransform... It works very well with the estimateTransform

stitcher.estimateTransform(imgs);
stitcher.composePanorama(pano);

But I found another way to compute the imagerotation etc, thats why I want to use composepanorama like this:

vector<Mat> imgs;

 imgs.push_back(image1);
 imgs.push_back(image2);
 imgs.push_back(image3);
 imgs.push_back(image4);
 imgs.push_back(image5);
 imgs.push_back(image6);   

stitcher.composePanorama(Inputimages,pano);

But everytime I trie this I get this error:

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

1 Answers1

2

If you go into stitcher.cpp:

Stitcher::Status Stitcher::composePanorama(InputArrayOfArrays images, OutputArray pano)
{
    LOGLN("Warping images (auxiliary)... ");

    std::vector<UMat> imgs;
    images.getUMatVector(imgs);
    if (!imgs.empty())
    {
        CV_Assert(imgs.size() == imgs_.size());

So if the global vector imgs_ is not initialized you'll get that assertion error. Since imgs_ is initialized in:

Stitcher::Status Stitcher::estimateTransform(InputArrayOfArrays images, const std::vector<std::vector<Rect> > &rois)
{
    images.getUMatVector(imgs_);

that is why your code is crashing if you don't call estimateTransform before composePanorama.

Finfa811
  • 618
  • 1
  • 8
  • 28