我在OpenCV
中编写了这个小程序,以便调整图像大小,然后编写新图像:
int main(int argc, const char * argv[]) {
Mat img_src;
Mat img_dst;
Size size(250,250);
img_src = imread("continuous object.png");
resize(img_src, img_dst, size);
imwrite("new_img.png", img_dst);
return 0;
}
当我尝试运行程序时,我在调整大小行中遇到了这个错误:
OpenCV Error: Assertion failed (ssize.area() > 0) in resize, file /Users/abc/Documents/opencv-3.0.0/modules/imgproc/src/imgwarp.cpp, line 3208
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/abc/Documents/opencv-3.0.0/modules/imgproc/src/imgwarp.cpp:3208: error: (-215) ssize.area() > 0 in function resize
(lldb)
为什么?我做错了什么?
感谢。