HSV value of a RGB pixel

asked 2015-09-23 02:46:55 -0500

sarjoondeen gravatar image

updated 2015-09-23 02:47:55 -0500

  1. Original.jpg

  2. HSV.jpg

The first image is the orginal BGR image and second (HSV.jpg) is the HSV color converted image

I opened the original image in GIMP editor and I checked the coordinate (300,300) and in that coordinate following values I found B:74 G:70 R:75 H:312 S:7 V:29

Then the same coordinate (300,300) when I checked in HSV converted image (HSV.jpg) I didn't find these "312,7,29" HSV values instead I found its RGB value.

I know that opencv doesn't display as HSV values, but then through what ways I will be able to get the HSV value of that particular coordinates(300,300) RGB pixel.

I thought conversion of BGR2HSV will do that and will give that values(312,7,29) but it didn't give those values Please help me understand with this.

Thanks in Advance Sarjoon.

edit retag flag offensive close merge delete



I think your answer is here

LBerger gravatar imageLBerger ( 2015-09-23 03:28:06 -0500 )edit

Check out the answer here, which will display BGR value and corresponding HSV value http://answers.opencv.org/question/30...

And if you want to segment the object then the answer here might be helpful http://answers.opencv.org/question/28...

Haris gravatar imageHaris ( 2015-09-23 04:20:36 -0500 )edit

also, since H has to fit into a [0..255] byte in opencv, the value is divided by 2, so in the [0..180] range, thus your example hsv values would be (156,7,29) in opencv

berak gravatar imageberak ( 2015-09-23 04:29:11 -0500 )edit

Thanks for the answers.. I understood how it works in Opencv.. Cheers :)

sarjoondeen gravatar imagesarjoondeen ( 2015-09-24 06:51:01 -0500 )edit