Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

imread flag for reading color image and equalizeHist output

So i took an image with photo booth, ordinary jpeg, but when loading it i get a assertion error that it needs to be CV_8UC1:

OpenCV Error: Assertion failed (_src.type() == CV_8UC1) in equalizeHist, file        

/Users/alefveld/Downloads/opencv/modules/imgproc/src/histogram.cpp, line 3688
libc++abi.dylib: terminating with uncaught exception of type cv::Exception:      /Users/alefveld/Downloads/opencv/modules/imgproc/src/histogram.cpp:3688: error: (-215) _src.type() == CV_8UC1 in function equalizeHist

If i use imread with ANYDEPTH flag it works (as opposed to using no flags at all). But then when i use equalizeHist, it pretty much seems to convert it to grayscale.

    Mat image=imread(filenames[0],CV_LOAD_IMAGE_ANYDEPTH);
    if(!image.data) {
    cout << "Could not open or find the

Shouldn't imread just be able to load any image? What flag should i use for loading a normal color image? And why is equalizeHist making the image look gray-ish. That way it almost seems pointless to convert it to grayscale.

Thanks for your help - as always.