Ask Your Question

Revision history [back]

inRange(hsv, Scalar(173, 70, 50), Scalar(179, 255, 255), mask1) returns a mask with white pixels giving you the location of the pixels that are within this range. You now have to make logic that has some sort of boolean return value.

Now do int number_pixels = countNonZero(mask1) and then threshold that value. For example, if more than 40 pixels respond, this is not noise and we execute the function.