4

I've been exercising many tutorials and examples for OpenCV, mainly for feature detection and extraction.

I'm using C++, Visual Studio 2012, and open CV 2.4.11.

My ultimate goal will be to detect, identify, and count boxes of cereal on a shelf. Imagine there are two boxes of Cheerios, one box cornflakes, and three boxes of Froot Loops. I want to identify and count the items.

I found an example and implemented a small test using car logos. My template logo is for the manufacturer Opel. I have a test image which has a half-dozen or so car logos including two instances of the Opel logo resized and rotated. The image below shows the results (I have manually drawn orange circles around the two Opel logos in the test image).

match

The two test Opel Logos each have more descriptor matches than any of the matches to the other Logos. I'm stuck at how I can group the matches and recognize that the two Opel logos are correct and disregard the others.

There must be a standard method of doing this, but my searches have not found it.

Can someone point me in the right direction – maybe to an example or the OpenCV functions I should be looking at?

Tot Zam
  • 8,406
  • 10
  • 51
  • 76
  • Interesting. I wonder if something like k-means would help in counting the number of matched points in a cluster.. – a-Jays Mar 20 '15 at 04:29
  • 2
    dont use only the best match for each feature but n best matches. then use some ransac transformation (rigid/affine/perspective) to find correct clusters. – Micka Mar 20 '15 at 06:36
  • Can you provide the images you're using? – zedv Mar 20 '15 at 11:09
  • Yes. I did a Google search for "feature homography jpg" (without the quotes) and found: http://i.stack.imgur.com/I1oRA.jpg . I copied and pasted then used the paint.net image editor to extract the train image and modify the target image. – user1247254 Mar 20 '15 at 16:47
  • have you got any solution to recognize that the two Opel logos are correct and disregard the others? –  Ritik Kumar Agrahari May 04 '17 at 09:41

1 Answers1

0

Template matching in opencv is more suitable method for your algo.

Another method is training haar cascade where you need to provide only one positive sample i.e logo.

Rahul galgali
  • 775
  • 2
  • 10
  • 26