【发布时间】:2016-08-24 23:58:42
【问题描述】:
我正在尝试使用 OpenCV 拼接器 编写代码来拼接一组图像并不断出现此错误。
OpenCV 错误:断言失败 (dsize.area() > 0 || (inv_scale_x > 0 && inv_scale_y > 0)) 在 cv::resize, 文件 C:\Users\car4p\Downloads\opencv-master\opencv-master\modules\imgproc\src\imgwarp.cpp, 第 3230 行
我四处搜索,发现这不是阅读图像的问题,图像显示都很好,并且有超过 0 列。我相信输出有错误,但不知道如何修复它。如果有人以前处理过此问题或知道解决方案,将不胜感激。
我使用 C++ 编写,使用 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];
}
【问题讨论】:
-
请花时间输入或复制/粘贴代码(据我计算,这正好是 8 行)。不要将文本和/或代码作为图像发布。
-
非常感谢。这是我的第一篇文章,我非常感谢您的帮助。我已经正确添加了代码,给您带来的不便敬请谅解。
-
谢谢,看起来不错。你有没有看到这个:stackoverflow.com/questions/31996367/… - 如果你有并且它没有帮助,请在你的问题中提到它。
标签: c++ opencv image-stitching opencv-stitching