2016-04-29 164 views
1

我正在尝试使用OpenCV拼接器编写代码来拼接一组图像,并不断提出这个错误。OpenCV拼接器抛出调整大小错误

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

我已经搜索周围,发现这不是阅读图像的问题,图像都显示正常,并有超过0 cols。我相信输出有错误,但无法弄清楚如何修复它。如果有人已经处理过这个或知道解决方案,将不胜感激。

我写在C++中,sticher类使用的OpenCV 3.1和Visual Studio 2015年

代码读取图像

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

代码拼接图像

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

    stitchs.createDefault(false); 

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

    return stitchedImg[0]; 
} 
+0

请花时间输入或复制/粘贴代码(我的计数正好是8行)。不要将文本和/或代码作为图像发布。 – Sabuncu

+0

非常感谢。这是我的第一篇文章,我非常感谢帮助。我已经正确地添加了代码,现在对于给您带来的不便表示抱歉。 – Car4p17

+0

谢谢,看起来不错。你见过这个:http://stackoverflow.com/questions/31996367/opencv-resize-fails-on-large-image-with-error-215-ssize-area-0-in-funct - 如果你有,它没有帮助,请在你的问题中提及它。 – Sabuncu

回答