Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

looking at your code,

Mat image = imread( "image.jpg", 0 ); // you're already loading it as grayscale

so, no further cvtColor() needed. and yes, cvtColor() will crash, trying to convert a non-color-input

Mat image = imread( "image.jpg", 1 ); // force loading as bgr
Mat gray_image;
cvtColor( image, gray_image, COLOR_BGR2GRAY); // won't crash