Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CV_8UC3 returns grayscale

Excuse me, I'm new to opencv. I learned about CV_8UC3 that it defines an image in 8 bit unsigned integers using 3 channels (BGR). When a color image is loaded using this constant as parameter,

cv::Mat image = cv::imread("image_file.jpg", CV_8UC3);

does that mean that it instructs to load the image as color image? I tried that to load and display using cv::namedWindow, as a result, the image is displayed in grayscale instead. But when the parameter CV_8UC3 is removed, the color image is loaded and displayed normally (as color image). Do I misunderstand the concept or is there (probably) a bug in my code?

Thank you very much. (I'm sorry if my English is not good)