Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotation and scale invariant template matching in OpenCV [duplicate]

Possible Duplicate:
scale and rotation Template matching

I have a template grayscale image , with white background and black shape over it. I also have several similar test images which vary in rotation and in shape. The test images are not same as template but they are similar.

I want to compare these two images and see if template matches , is most similar to, any of the test images. There are no distortions , no noise and no other defects in the images. Are there any tutorials on this topic ?

like image 796
rajat Avatar asked Sep 26 '12 12:09

rajat


1 Answers

Try the easiest method first.

If I understand you correctly you have some model - black shape over white background. You can treat it as blob - find it's mass center and rotation by computing principal axes angle - look there.

Then you must segment out shapes from other images. Then try to find the best corresponding shape with matchShapes() function - see there how to use it.

matchShapes() function makes scale and rotation invariant matching. The smallest match shapes result the better match.

Extending your question you can find mass center and rotation of best matching blob and find rotation, scale and displacement between your model and matched image.

like image 184
krzych Avatar answered Sep 22 '22 02:09

krzych