How to find round filled circles?

asked 2018-07-24 08:10:12 -0600

federicoponzi gravatar image

Hello,

I'm trying to create a simple prototype of a car. It should be able to recognize a stop signal, and a semaphore (red/green). I've realized the stop signal detector using haar features but I've a problem with the stop signal, which from distance is recognized as a red semaphore.

I use the following code to detect the red colour:

        Core.inRange(hsv, redColors.get(0).first,
                redColors.get(0).second, mask1);
        Core.inRange(hsv, redColors.get(1).first,
                redColors.get(1).second, mask2);
        Core.bitwise_or(mask1, mask2, hsv);

And then I use the HoguhCircles function in order to find the circles in the image. The main problem is, that hough circles search for round contours, but In principle I can differentiate between a stop with a red traffic light by exploiting the fact that the traffic light is a red round filled circle.

For this reason, I was wondering if there is a way to find a round, filled circle - or if you can suggest an alternative to disambiguize the two.

Thanks

edit retag flag offensive close merge delete

Comments

Forget HAAR, move on to CNN based object detection like the YOLO detector, and your mistakes between semaphores and stop signals will be gone completely. Its much more powerful.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-07-25 04:13:43 -0600 )edit