Scale and Rotation Template Matching

scale and rotation Template matching in opencv

You can try Generalized Hough Transform (GHT), to find contours using template. As I remember, there was ready to use implementation in opencv (gpu) examples.(opencv/samples/gpu/generalized_hough.cpp on my machine)

Here is also useful link with source code: http://www.itriacasa.it/generalized-hough-transform/instructions.html

Rotation and scale invariant template matching in OpenCV

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.



Related Topics



Leave a reply



Submit