Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the range of hue 0-180° in opencv

Tags:

opencv

hsv

Can anybody explain to me why the hue value of an HSV image in OpenCV only goes to 180° and not the full 360°?

I have found somewhere that OpenCV uses a 180° cylinder, but I can not really visualize such a cylinder.

Thanks in advance!
J

like image 655
JasperV Avatar asked May 22 '13 07:05

JasperV


People also ask

What is hue in OpenCV?

The HSV or Hue, Saturation, and value of a given object is the color space associated with the object in OpenCV. The Hue in HSV represents the color, Saturation in HSV represents the greyness, and Value in HSV represents the brightness.

What is the range of hue in the HSV color model?

1. HSV Color Scale: The HSV (which stands for Hue Saturation Value) scale provides a numerical readout of your image that corresponds to the color names contained therein. Hue is measured in degrees from 0 to 360. For instance, cyan falls between 181–240 degrees, and magenta falls between 301–360 degrees.

What range of values are supported in OpenCV's representation of hue?

In OpenCV, Hue has values from 0 to 180, Saturation and Value from 0 to 255. Thus, OpenCV uses HSV ranges between (0-180, 0-255, 0-255).


2 Answers

try to put 360 into a uchar ;)

so, it's just divided by 2 to make it fit..

like image 181
berak Avatar answered Oct 17 '22 10:10

berak


The ranges that OpenCV manage for HSV format are the following:

For HSV, Hue range is [0,179], Saturation range is [0,255] and Value range is [0,255]. Different softwares use different scales. So if you are comparing OpenCV values with them, you need to normalize these ranges.

Here is the link to the OpenCV documentation that explains it.

http://docs.opencv.org/3.2.0/df/d9d/tutorial_py_colorspaces.html

like image 22
Kevin Infante Avatar answered Oct 17 '22 11:10

Kevin Infante