This code I have found attempt to track red color in 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 RGB? I just don t know what exactly was the range for every color in order to track it, e.g. red color range in YCrCb.
Edit: I ve tried HSV, It doesn t give better result than RGB above as expected, consequently, I consider to use YCrCb.
Thanks.