This code I found trying to track red in the RGB color space,
// red color detection, turn the detected one into white if (((red > (0.85 * (green + blue))) && (red > 105)) && ((red - green > 73)) && (((green < 150) || ((green >= 150) && (blue > 140))))) { // set the pixel to white red = 255; green = 255; blue = 255; }
Does anyone know how to track color using YCrCb color space instead of RGB? I just don’t know which range for each color to track it, for example. red color in YCrCb.
Edit : I tried HSV, it does not give a better result than RGB is higher than therefore, I think use YCrCb.
Thank.
. (YCrCb) , mpeg. , 4: 2: 2, , Y ( ) RGB, Yb ( ) Yr ( ) . .
, , , HSV ( HSI). H (Hue) , 0..359 (360 ). , 0..255, 16- . S ( H ), S ( I) .
:
I = 1/3 * (R + G + B)
S = 1 - (3/(R + G + B)) * (min (R, G, B))
HSV, , , .
In YCbCr, a typical range is from 16 to 240 for each component. See the Next Wikipedia Entry for various formulas for converting between RGB and YCbCr.
Source: https://habr.com/ru/post/1785630/More articles:OpenTK Text Animation - c #Media Player window detection - pythonIncorrect function porting in Python to C using the Python C API - pythonUnable to create JPA objects from HSQLDB - jpa-2.0Pixel color matching score - cHow to cut URL variable - coldfusionScaling in UIScrollView with paging support and multiple images - objective-cWMI technical product - windows-7Template in template (.tpl) smarty - phpChange cell contents from another cell - javascriptAll Articles