Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

color.cpp:3380: error: (-215) (scn == 3 || scn == 4) && depth == CV_8U in function cvtColor

Hi!

I'm completed the OpenCV iOS video processing tutorial, but I get this exception when running the completed app:

libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/vp/work/opencv/modules/imgproc/src/color.cpp:3380: error: (-215) (scn == 3 || scn == 4) && depth == CV_8U in function cvtColor

The exception is thrown by this function:

- (void)processImage:(Mat&)image;
{
    // Do some OpenCV stuff with the image
    Mat image_copy;
    cvtColor(image, image_copy, COLOR_BGR2GRAY);

    //invert image
    bitwise_not(image_copy, image_copy);
    cvtColor(image_copy, image, COLOR_BGR2BGRA);
}

on the line cvtColor(image_copy, image, COLOR_BGR2BGRA);

What exactly is going on?