我发现这段代码试图在 RGB 颜色空间中跟踪红色,
// 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;
}
有谁知道如何使用 YCrCb 颜色空间而不是 RGB 来跟踪颜色?我只是不知道每种颜色的准确范围是多少,以便跟踪它,例如 YCrCb 中的红色范围。
编辑:我已经尝试过 HSV,它并没有像预期的那样给出比 RGB 更好的结果,因此,我考虑使用 YCrCb。
谢谢。