Ask Your Question

template matching in source image containing multiple rotated images

asked 2017-12-16 16:36:41 -0500

dave.gromax gravatar image

updated 2018-08-28 11:36:12 -0500


I am new to openCV2, and am wondering does template matching would work in case there are multiple copies in source image where each is rotated by some angle. To start with I am using this example code:

where I am using a modified image and rotated one of the mario coins almost 90 degrees (horizontal) and rest are vertical as in original. I did these tests:

1) vertical coin template: - cropped one vertical coin to use as a template. Using same code as in the link above I get vertical coins detected if use threshold 0.8 but to detect rotated coin I need to reduce threshold to 0.5.

2) Rotated coin template: - rotated coin as a template then using 0.8 threshold I detect only rotated coin image and if I reduce threshold to 0.5 I detect rotated and vertical coins.

Is it correct or there are other smart ways?

Thanks Dave

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-12-16 17:51:25 -0500

matman gravatar image

Simple template matching is not rotation (and scale) invariant. Take a look at this project.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-12-16 16:36:41 -0500

Seen: 337 times

Last updated: Dec 16 '17