Opencv Logo Recognition

OpenCV logo recognition

It largely depends on your kind of images.

  • If your logo occupies say 90% of the image, you don't need detection, since you are probably good with color histograms.
  • If the logo is small compared to the image, you should "find" the logo, in order to focus your comparison on that and not on the background clutter.
  • There could be multiple logos on the same image?
  • The logo is always fully visible?
  • The logo is rigid? Or could be deformed? (think for example of a logo on a shirt or a small bottle)

Assuming that you have a single complete rigid logo to find, the simplest thing to try is template matching.

A more accurate approach is to match descriptors.
You can also see a related topic on SO here

Other more robust approaches would require to build constellations of keypoints on your reference logo, and match those constellations on the target image. See here and here for an example.

Last, but not least, have fun on Google!

Logo detection/recognition in natural images

There are many algorithms from shape matching to haar classifiers. The best algorithm very depend on kind of logo.

If you want to continue with feature registration, i recommend:

  1. For detection of small logos, use tiles. Split whole image to smaller (overlapping) tiles and perform usual detection. It will use "locality" of searched features.

  2. Try ASIFT for affine invariant detection.

  3. Use many template images for reference feature extraction, with different lightning , different background images (black, white, gray)

Logo recognition in images

You could try to use local features like SIFT here:
http://en.wikipedia.org/wiki/Scale-invariant_feature_transform

It should work because logo shape is usually constant, so extracted features shall match well.

The workflow will be like this:

  1. Detect corners (e.g. Harris corner detector) - for Nike logo they are two sharp ends.

  2. Compute descriptors (like SIFT - 128D integer vector)

  3. On training stage remember them; on matching stage find nearest neighbours for every feature in the database obtained during training. Finally, you have a set of matches (some of them are probably wrong).

  4. Seed out wrong matches using RANSAC. Thus you'll get the matrix that describes transform from ideal logo image to one where you find the logo. Depending on the settings, you could allow different kinds of transforms (just translation; translation and rotation; affine transform).

Szeliski's book has a chapter (4.1) on local features.
http://research.microsoft.com/en-us/um/people/szeliski/Book/

P.S.

  1. I assumed you wanna find logos in photos, for example find all Pepsi billboards, so they could be distorted. If you need to find a TV channel logo on the screen (so that it is not rotated and scaled), you could do it easier (pattern matching or something).

  2. Conventional SIFT does not consider color information. Since logos usually have constant colors (though the exact color depends on lightning and camera) you might want to consider color information somehow.

Logo detection using OpenCV

You may want to go with SIFT using Rob Hess' SIFT Library. It's using OpenCV and also pretty fast. I guess that easier than your current way of approaching the logo detection :)

Try also looking for SURF, which claims to be faster & robuster than SIFT. This Feature Detection tutorial will help you.



Related Topics



Leave a reply



Submit