What is the best method to template match a image with noise?

I have a large image (5400x3600) that has multiple CCTVs that I need to detect.

The detection takes lot of time (4-7 minutes) with rotation. But it still fails to resolve certain CCTVs.

What is the best method to match a template like this?

I am using skImage - openCV is not an option for me, but I am open to suggestions on that too.

For example: in the images below, the template is correct matched with the second image - but the first image is not matched - I guess due to the noise created by the text "BLDG..."


Source image:

Match result:


The fastest method is probably a cascade of boosted classifiers trained with several variations of your logo and possibly a few rotations and some negative examples too (non-logos). You have to roughly scale your overall image so the test and training examples are approximately matched by scale. Unlike SIFT or SURF that spend a lot of time in searching for interest points and creating descriptors for both learning and searching, binary classifiers shift most of the burden to a training stage while your testing or search will be much faster.

In short, the cascade would run in such a way that a very first test would discard a large portion of the image. If the first test passes the others will follow and refine. They will be super fast consisting of just a few intensity comparison in average around each point. Only a few locations will pass the whole cascade and can be verified with additional tests such as your rotation-correlation routine.

Thus, the classifiers are effective not only because they quickly detect your object but because they can also quickly discard non-object areas. To read more about boosted classifiers see a following openCV section.

This problem in general is addressed by Logo Detection. See this for similar discussion. There are many robust methods for template matching. See this or google for a very detailed discussion.

But from your example i can guess that following approach would work.

  1. Create a feature for your search image. It essentially has a rectangle enclosing "CCTV" word. So the width, height, angle, and individual character features for matching the textual information could be a suitable choice. (Or you may also use the image having "CCTV". In that case the method will not be scale invariant.)

  2. Now when searching first detect rectangles. Then use the angle to prune your search space and also use image transformation to align the rectangles in parallel to axis. (This should take care of the need for the rotation). Then according to the feature choosen in step 1, match the text content. If you use individual character features, then probably your template matching step is essentially a classification step. Otherwise if you use image for matching, you may use cv::matchTemplate.

Hope it helps.

Symbol spotting is more complicated than logo spotting because interest points work hardly on document images such as architectural plans. Many conferences deals with pattern recognition, each year there are many new algorithms for symbol spotting so giving you the best method is not possible. You could check IAPR conferences : ICPR, ICDAR, DAS, GREC (Workshop on Graphics Recognition), etc. This researchers focus on this topic : M Rusiñol, J Lladós, S Tabbone, J-Y Ramel, M Liwicki, etc. They work on several techniques for improving symbol spotting such as : vectorial signatures, graph based signature and so on (check google scholar for more papers).

An easy way to start a new approach is to work with simples shapes such as lines, rectangles, triangles instead of matching everything at one time.

Your example can be recognized by shape matching (contour matching), much faster than 4 minutes.

For good match , you require nice preprocess and denoise.

examples can be found http://www.halcon.com/applications/application.pl?name=shapematch

Need Your Help

Can someone help with big O notation?

algorithm recursion big-o

void printScientificNotation(double value, int powerOfTen)

Equal height rows in a flex container

html css css3 flexbox

As you can see, the list-items in the first row have same height. But items in the second row have different heights. I want all items to have a uniform height.