Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert RGB image to HSV using OpenCV
Mat srcImg = imread("image.jpg", CV_LOAD_IMAGE_COLOR);
Mat srcHSVImage, hue, sat, val;
vector<Mat> hsv;
cvtColor(srcImg, srcHSVImage, CV_BGR2HSV_FULL);
split(srcHSVImage,hsv);
hsv[0].copyTo (hue); //Hue channel
hsv[1].copyTo(sat); //Saturation channel
hsv[2].copyTo(val); //Value channel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment