这是我的代码,它非常简单。
Mat image = imread("filename.png");
imshow("image", image);
waitKey();
//Image looks great.
Mat image_gray;
image.convertTo(image_gray, CV_RGB2GRAY);
imshow("image", image_gray);
waitKey();
但是当我调用image.convertTo(image_gray, CV_RGB2GRAY);
这一行时,我收到了以下错误消息:
OpenCV Error: Assertion failed (func != 0) in unknown function, file ..\..\..\sr
c\opencv\modules\core\src\convert.cpp, line 1020
使用 OpenCV 2.4.3
Mat image_gray = imread("filename.png", CV_LOAD_IMAGE_GRAYSCALE);
- Ove