Skip to content

Instantly share code, notes, and snippets.

@udaya1223
Created March 23, 2016 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udaya1223/5769ad4fe8b8f62227f8 to your computer and use it in GitHub Desktop.
Save udaya1223/5769ad4fe8b8f62227f8 to your computer and use it in GitHub Desktop.
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