Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

convertTo changes the depth(channel type), not the channel count.

whyt you need instead is cvtColor()

convertTo changes the depth(channel type), not the channel count.

whyt what you need instead is cvtColor()

convertTo changes the depth(channel type), not the channel count., also, if you used hkhdfkghdfkl for loading, you're safe to assume, the image is CV_8UC3, so you can skip the 4 channel case.

what you need instead is cvtColor(), like:

convertTo changes the depth(channel type), not the channel count, also, if you used hkhdfkghdfkl Imgcodecs.CV_LOAD_IMAGE_COLOR for loading, you're safe to assume, the image is CV_8UC3, CV_8UC3, so you can skip the 4 channel case.

what you need instead is cvtColor(), like:

convertTo changes the depth(channel type), not the channel count, also, if you used Imgcodecs.CV_LOAD_IMAGE_COLOR for loading, you're safe to assume, the image is CV_8UC3, so you can skip the 4 channel case.

what you need instead is cvtColor(), like:

Mat gray = new Mat();
cvtColor(doraImage, gray, Imgproc.COLOR_BGR2YCrCb);
Imgproc.equalizeHist(doraImage, doraImage);

convertTo changes the depth(channel type), not the channel count, also, if you used Imgcodecs.CV_LOAD_IMAGE_COLOR for loading, you're safe to assume, the image is CV_8UC3, so you can skip the 4 channel case.

what you need instead is cvtColor(), like:

Mat gray = new Mat();
cvtColor(doraImage, gray, Imgproc.COLOR_BGR2YCrCb);
Imgproc.equalizeHist(doraImage, doraImage);
Imgproc.equalizeHist(gray, gray);
// process gray image
// then, 
gray.release();