HSV colour space and CvInRangeS function

て烟熏妆下的殇ゞ 提交于 2019-12-04 16:54:11
Sam Felix

It means

H - Hue, S - Saturation, V - Value

take a look in here for understanding each one of those:

http://en.wikipedia.org/wiki/HSL_and_HSV

the color is mainly defined in the Hue component. There is a good tutorial about thresholding in HSV space in here:

http://aishack.in/tutorials/thresholding/

Abid Rahman K

cvInrangeS function checks that array elements lie between two scalars.

First cvScalar value denotes inclusive lower boundary. Second cvScalar value denotes exclusive upper boundary.

cvInrangeS doesn't care the values you give as either RGB or BGR or HSV etc. It just goes through the array elements you give as input (first parameter)(here it is an image) and checks if elements are in the given range you specified. If so, it is selected, otherwise rejected. And feed result to last parameter, your output image.

Check out its documentation

Now here if you give a HSV image. So cvScalar denotes lowest and highest color of range you want to extract.

If it is RGB image, you specify min and max RGB colors.

And better use HSV because it provides good result. Read here.

And now if you want to convert RGB to HSV values, Try here and here.

(Remember, in OpenCV red and blue interchanged. It is BGR, not RGB).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!