0

I have an image of a target as shown below:

enter image description here

and I have a picture full of them that each is scaled and rotated. I need to detect the center of targers in the second image.

How can I do this?

I know how to use SURF to detect match points between two image. But I don't know how to use it to detect one image in another image when there's more than one instance of the reference image in the containing image.

I also don't know how to detect the center of a target when I detect the target image in the containing image.

I'm using openCV 2.4.6 and Visual Studio 2012.

The output should be something like this:

enter image description here

Please note the targets that I draw a circle to define their centre. I need the centre x,y to use them in another process.

Edit1

Based on suggestions, I threshold the image, then use find contour to generate this image:

enter image description here

Now I have two questions:

  1. How can I filter out contours which is not related to any target?
  2. How to detect the center of a target?
Community
  • 1
  • 1
mans
  • 17,104
  • 45
  • 172
  • 321
  • Can you show the second picture and show example output just by annotating manually? – guneykayim Oct 21 '13 at 12:51
  • @guneykayim: the other image is added. I need the x,y of each centre for processing in another system. – mans Oct 21 '13 at 13:15
  • Why don't you use just a simple thresholding and blob finding? You can get the centroids of the blobs easily. – toderik Oct 21 '13 at 13:19
  • @toderik: Thanks, any sample code on how to do this? – mans Oct 21 '13 at 13:25
  • @mans Well, I haven't used OpenCV recently, so I can't give you an exact solution to this (in pseudo code maybe, but that wasn't the question I suppose). So check this out: https://code.google.com/p/cvblob/ And also this: http://stackoverflow.com/questions/4641817/blob-extraction-in-opencv/4641898#4641898 – toderik Oct 21 '13 at 13:30

1 Answers1

1

Your image seems too simple for SURF or any other feature extraction methods. Here is an approach I would follow:

  1. thresholding
  2. Connected component labeling
  3. Get the centroid of the blobs

Obviously each step can be detailed based on your image complexity. For example adaptive thresholding or blob filtering based on their features could be necessary.

toderik
  • 479
  • 4
  • 8