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

Exterior shot of a metropolitan roadside


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

enter image description here

After Dilation :

enter image description here

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

enter image description here

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

Edit : i just want these parts of my image

enter image description here

Taking another input image :

enter image description here

Applying median filtering and edge detection :

enter image description here

After Bottom hat filtering:

enter image description here

How do i isolate the road signs please help?

  • $\begingroup$ 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? $\endgroup$
    – endolith
    Feb 4, 2012 at 15:27
  • $\begingroup$ Yes only the signs $\endgroup$
    – vini
    Feb 4, 2012 at 15:39
  • $\begingroup$ What approach have you tried yourself? $\endgroup$
    – Maurits
    Feb 4, 2012 at 20:53
  • $\begingroup$ Yes i do have templates $\endgroup$
    – vini
    Feb 5, 2012 at 3:18
  • $\begingroup$ Have edited @mauritis $\endgroup$
    – vini
    Feb 5, 2012 at 3:19

4 Answers 4


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:

enter image description here

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

enter image description here

and the best match is found at the right position:

enter image description here

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

  • 1
    $\begingroup$ @nikie: Could you explain the process you used? $\endgroup$
    – smokris
    Feb 7, 2012 at 2:24
  • $\begingroup$ Yeah that would help a bit more . The idea seems good $\endgroup$
    – vini
    Feb 8, 2012 at 1:43
  • $\begingroup$ @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. $\endgroup$ Feb 9, 2012 at 4:56
  • $\begingroup$ It is amazing how different would be the method to do so in our days. $\endgroup$
    – David
    Feb 27, 2023 at 8:26

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.

Try following two links : Link 1, Link 2

  • $\begingroup$ dead links, unfortunately $\endgroup$
    – CharlesB
    May 29, 2012 at 14:35
  • $\begingroup$ Actually both the links works for me. $\endgroup$ May 30, 2012 at 13:58
  • $\begingroup$ @CharlesB : The links are updated :) $\endgroup$
    – Anoop K P
    Oct 26, 2012 at 9:12

I'm definitely not an expert here but you can start with edge detection (such as canny), then hough transform to detect circles, rectangles, squares, or triangles (based on the sign ou want to detect), then you can do template matching or histogram matching, if the colors are distinct enough (over the candidates returned by the hough transform).

The first step (detecting the candidates using hough transform) is the harder step. I can think of many ways to try to detect whether that candidate is the sign or not. This is a fun problem. Enjoy solving it :)

By the way, I'm sure you can find good research articles that are highly related


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.