# How to extract traffic signs from a photograph?

What image analysis techniques can I use to extract the traffic signs from an image such as the one below?

Edit:

After Anisotropic diffusion: The background that i don't want gets cleared a little

After Dilation :

Thresholding after Diffusion : Not able to figure out the best thresholding for this purpose

However i am not able to figure out how to remove the background?

Edit : i just want these parts of my image

Taking another input image :

Applying median filtering and edge detection :

After Bottom hat filtering:

• To me, "traffic signal" means a lit up device justsymbol.com/images/traffic-signal-sign-6.png , not a sign. Do you mean only signs? – endolith Feb 4 '12 at 15:27
• Yes only the signs – vini Feb 4 '12 at 15:39
• What approach have you tried yourself? – Maurits Feb 4 '12 at 20:53
• Yes i do have templates – vini Feb 5 '12 at 3:18
• Have edited @mauritis – vini Feb 5 '12 at 3:19

Did you try something simple like correlation?

(EDIT). The idea behind correlation is to use a template (in your case a trained road sign sample), and compare it to every position in the test image. The comparison operation I've used to generate the images below is called normalized cross-correlation. Roughly speaking, you standardize (mean=0, standard deviation=1) the pixels in the template and the image part you want to match, multiply them pixel by pixel, and calculate the mean value of the products. This way you get a "match score", i.e. a measure of similarity between the template and the test image at every position in the test image. The position with the best match (highest correlation) is the most probably candidate for the position of the road sign. (Actually, I've used the Mathematica function CorrelationDistance to generate the image below, which is 1 - (normalized correlation). So the darkest spot in the match image corresponds to the best match).

I don't have any other templates, so I simple cropped the sign from the second picture you posted:

Even though the template is rotated slightly, cross correlation still looks usable

and the best match is found at the right position:

(You'd need multiple scaled versions of each template to detect signs at any size, of course)

• @nikie: Could you explain the process you used? – smokris Feb 7 '12 at 2:24
• Yeah that would help a bit more . The idea seems good – vini Feb 8 '12 at 1:43
• @vini If you have templates and you're trying to find instances of it in your image, cross-correlation is the most natural approach and should be among the first approaches you try. Here's an answer here (Mathematica code) and another on SO (MATLAB code) where I use this approach. – Lorem Ipsum Feb 9 '12 at 4:56

During my Masters, the project my supervisor was involved in was dealing in detecting and recognizing all kinds of different traffic signalization in a video sequences (e.g. road detection, road centerline detection, but also traffic sign detection and recognition). The video frames we were working on are in many ways similar to your example images.

While I personally didn't work on traffic signs, I think the best results were obtained by using the Viola-Jones Algorithm (paper). In short, it is an algorithm that uses a cascade of weak classifiers (with accuracy just a bit higher than that of a random algorithm) to construct a strong classifier that is robust even in difficult tasks.

The project was called MASTIF (Mapping and Assessing the State of Traffic InFrastructure) and did some really good work. Project's publication page could be really useful because it provides links to all the published papers related to the project. Just to give you an idea, let me single some of the publications out (in chronological order):

Once again, I didn't personally work on traffic signs, but I think you can find plenty of useful material here. Also, I would suggest going through cited references in the papers as they can be of help as well.

Well, googling road way signs detection gives you plenty of good papers on this topic.

Some uses color segmentation due peculiar blue,green,red colors etc.

Some apply Gaussian smoothing first, then canny edge detection and contour finding to extract the sign board.