3

I have a problem over here with some simple stitching tool test using OpenCV.

Here s my code:

IplImage *pLeft,
         *pRight;
pLeft = cvLoadImage( "left.jpg" );
pRight = cvLoadImage( "right.jpg" );

cv::Mat cvMatLeft( pLeft, true ),
        cvMatRight( pRight, true );

std::vector<cv::Mat> imgs;
imgs.push_back( cvMatLeft );
imgs.push_back( cvMatRight );

cv::Mat cvMatOutput;

cv::Stitcher myStitcher = cv::Stitcher::createDefault( true );
cv::Stitcher::Status myStatus = myStitcher.stitch( imgs, cvMatOutput );

I get back the enum ERR_NEED_MORE_IMGS while running this code. When i debug into the functions called by OpenCV i did recognize the following uncertainty:

stitch( )'s first argument is an cv::InputArray named images. Taking a closer look at it shows, that the arguments sz.width and sz.height are 0. Further on running through estimateTransform( ) twice the function matchImages( ) is called where the member imgs_ is checked. This one is derived from the InputArray and has (resulting) the size( ) (of images) being 0.

This leads to the mentioned enum.

What am i doing wrong? Something on initialization of the stitcher or the cv::Mat?

Thanks in advance

jo3ran
  • 31
  • 1
  • 2
  • What does imgs.size() return right before calling stitch? Also, is there any reason you convert from IplImage and you don't read the image in a Mat directly using imread? – Sassa Sep 19 '12 at 15:24
  • 1
    Can you post the `left.jpg` and `right.jpg` images? I'd like to try to reproduce this locally. – solvingPuzzles Sep 20 '12 at 07:10
  • 1
    @solvingPuzzles: i am getting the same status and i used the images which are in this post: [link](http://stackoverflow.com/questions/10256802/how-to-merge-two-images-in-opencv) – Vinshi Dec 19 '12 at 21:21

1 Answers1

0

I think it occurs when you use similar image. When you use the images which the number of extraced feature points is small, so it does.

Hwan
  • 1
  • 1
    Hi Hwan, welcome to Stack Overflow. It's preferred if you could substantiate your answers with more information as to why that is the case, and how it applies to the question. Also, references (if applicable) go a long way to improving the quality of an answer. Try taking these steps to improve your answer - it really helps! To learn more about Stack Overflow and working your way round here, visit the [About] page. Thanks! – Qantas 94 Heavy Sep 05 '13 at 12:18