Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you've been probably doing something like this:

cvtColor( bgr,hsv, CV_RGB2HSV )

now, you want to separate the H channel ( it's the same 1 channel image as a greyscale, actually )

Mat chan[3];
split( hsv, chan );
Mat H = hsv[0];

and threshold that:

Mat binary;
threshold(H, binary, 1 /*ignored for otsu*/, 255, CV_THRESH_OTSU);

note, that there's also adaptiveThreshold, and CLAHE