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)就可以,直接用切出来的图就不行,很奇怪

OpenCV(3.4.1) Error: Assertion failed (scn == 1 && (dcn == 3 || dcn == 4)) in c报错,求助贴

 

OpenCV(3.4.1) Error: Assertion failed (scn == 1 && (dcn == 3 || dcn == 4)) in c报错,求助贴

 

解决了原来是粗心导致的

COLOR_GRAY2BGR————>CV_BGR2GRAY

长记性了,初学者,耗费了半个小时!!!!

相关文章:

  • 2021-09-16
  • 2021-07-09
  • 2022-01-05
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2021-10-12
猜你喜欢
  • 2021-04-24
  • 2021-09-16
  • 2021-10-10
  • 2021-09-16
  • 2021-10-02
  • 2021-07-24
  • 2021-12-06
相关资源
相似解决方案