OpenCV better detection of red color?
In HSV space, the red color wraps around 180. So you need the H values to be both in [0,10] and [170, 180]. Try this: #include <opencv2\opencv.hpp> using namespace cv; int main() { Mat3b bgr = imread(“path_to_image”); Mat3b hsv; cvtColor(bgr, hsv, COLOR_BGR2HSV); Mat1b mask1, mask2; inRange(hsv, Scalar(0, 70, 50), Scalar(10, 255, 255), mask1); inRange(hsv, Scalar(170, … Read more