1

I am trying to write code using the OpenCV stitcher to stitch together a set of images and keep coming up with this error.

OpenCV Error: Assertion failed (dsize.area() > 0 || (inv_scale_x > 0 && inv_scale_y > 0)) in cv::resize, file C:\Users\car4p\Downloads\opencv-master\opencv-master\modules\imgproc\src\imgwarp.cpp, line 3230

I have searched around and found that this is not a problem with reading the images, the images both display fine and have more than 0 cols. I believe there is an error with the output but can't figure out how to fix it. If anyone has dealt with this before or knows a solution it would be much appreciated.

I'm writing in C++, using OpenCV 3.1 and Visual Studio 2015.

Code for Reading Images

imgs.push_back(imread("testerer1.jpg"));
imgs.push_back(imread("testerer2.jpg"));
imgs.push_back(imread("testerer3.jpg"));    
imgs.push_back(imread("testerer4.jpg"));

Code for Stitching Images

Mat stitchImages(vector<Mat> imgs) {
    Stitcher stitchs;
    vector<Mat> stitchedImg;

    stitchs.createDefault(false);

    Stitcher::Status status = stitchs.stitch(imgs, stitchedImg);

    return stitchedImg[0];
}
Tony Hinkle
  • 4,706
  • 7
  • 23
  • 35
Car4p17
  • 45
  • 1
  • 6
  • Please take the time to type in or copy/paste the code (which is exactly 8 lines by my count). Do not post text and/or code as images. – Sabuncu Apr 29 '16 at 18:12
  • Thank you so much. This is my first post I really appreciated the help. I have added the code correctly now sorry for the inconvenience. – Car4p17 Apr 29 '16 at 18:22
  • Thanks, looks good. Have you seen this: http://stackoverflow.com/questions/31996367/opencv-resize-fails-on-large-image-with-error-215-ssize-area-0-in-funct - if you have and it does not help, please mention it in your question. – Sabuncu Apr 29 '16 at 18:29
  • Also see this answer: http://stackoverflow.com/a/20683727/360840 – Sabuncu Apr 29 '16 at 18:31

1 Answers1

0

Second parameters in sticher class is a Mat (ouputarray) not a vector < Mat >

see http://docs.opencv.org/master/d2/d8d/classcv_1_1Stitcher.html#details

LBerger
  • 593
  • 2
  • 12