这是我的代码。这很简单。
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