top of page

Saturday Morning Coding - Template Matching and Sign Detection


Edi 2/9/2019: Turns out I didn't leave a link to the github repo for this. So here it is! https://github.com/Corey255A1/BasicPythonOpenCVTemplateMatch/tree/master/SignDetector


One of the most recent projects I have been working on is making a off the shelf RC car with the price limit set to $30 into an Autonomous vehicle. That is what sent me off in the direction of machine learning and also computer vision.

Eventually the plan is to have a car use neural networks trained to steer the car around a course marked out with edge lines. But I'm not there yet.

For now, I wanted to get the car at least moving by itself using visual processing, so today I decided to use a computer vision technique called template matching.

I wrote the code to distinguish between 3 Road signs. Stop, Turn Left and Turn Right. The plan is to place these road signs out and have the car move and follow the signs.

Here is a demo of the code detecting the road signs.


Template matching works basically by taking a template image, and sliding it across the whole frame and creating a new image of points representing how similar that area is to the template image. The higher the number the more similar that region is to the template. The Green number in the video goes between 0 and 1, 1 meaning the region is exactly the same as the image.

In this video below, I show the side by side of the frame from the web cam on the right, and on the left the template matching output. You can see the bright point representing the area of the matched template.


Next up, getting this to work on the Raspberry pi and controlling the RC car!

Comments


bottom of page