Ask Your Question

Revision history [back]

template matching in source image containing multiple rotated images

Hi,

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:

https://docs.opencv.org/trunk/d4/dc6/tutorial_py_template_matching.html

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

template matching in source image containing multiple rotated images

Hi,

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:

https://docs.opencv.org/trunk/d4/dc6/tutorial_py_template_matching.html

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