OpenCV(3.4.1) Error: Assertion failed (scn == 1 && (dcn == 3 || dcn == 4)) in cv::cvtColor, file C:\\build\\master_winpack-build-win64-vc14\\opencv\\modules\\imgproc\\src\\color.cpp, line 11164
简单的一个灰度转换
int main()
{
Mat img,imgOut;
VideoCapture capture;
img=imread(\”E:\\\\opencv-solgen\\\\training\\\\img3695.jpg\”);
//opencv3.4.1用COLOR_GRAY2BGR,4.0用CV_
cvtColor(img, imgOut, COLOR_GRAY2BGR);
imwrite(\”E:\\\\opencv-solgen\\\\training\\\\img3695gray.jpg\”, imgOut);
return 0;
}
奔溃,咋会事,从视频中读取使用VideoCapture capture;的capture.read(img)就可以,直接用切出来的图就不行,很奇怪
解决了原来是粗心导致的
COLOR_GRAY2BGR————>CV_BGR2GRAY
长记性了,初学者,耗费了半个小时!!!!