cvtColor assertion failed ( OpenCV with C++ )

后端 未结 3 501
难免孤独
难免孤独 2021-01-14 00:10

I have a

cv::Mat image;

object, which I loaded an image to from a file, it reads it correctly and all.

Now I have written a functio

相关标签:
3条回答
  • 2021-01-14 00:20

    Try image.clone() for coping images

    0 讨论(0)
  • 2021-01-14 00:26
    if(!image.empty()) {
        //your_code
    } else
        std::cout<<"Emty "
    

    check the matrix before you convert.

    0 讨论(0)
  • 2021-01-14 00:43

    Try using different dst image:

    cv::Mat grayImage;
    cv::cvtColor(image, grayImage, CV_RGB2GRAY);
    
    0 讨论(0)
提交回复
热议问题