Ask Your Question

Scale-rotation-skew invariant template matching

asked 2016-08-02 16:27:08 -0500

nico_lauda gravatar image

updated 2016-08-03 22:27:02 -0500

Hi all,

I need to find the target in an image. The target can assume whichever orientation, and can be scaled. Moreover, the image can be acquired from different camera's angulations.

Do you know if a template matching algorithm that is rotation, scale and skew invariant already exists in OpenCV? In industrial robotics applications, those kinds of algorithms already exist, and they work pretty well. Otherwise, what approach could work?

An example of the images that I would use is attached to the post.

Thanks everybody for the help.


C:\fakepath\img13.png C:\fakepath\target.png

P.S.: I'm sorry to have edited this question different times, I know it is a little confusing.

edit retag flag offensive close merge delete


If pca won't work it means that arrow is symetric. May be you should try somthing like this

LBerger gravatar imageLBerger ( 2016-08-03 03:26:43 -0500 )edit

Actually, I don't care if the arrow is symmetric, but it is important that the algorithm finds the relative rotation from the template. I've just tried the algorithm that you have suggested, but as it is, it returns -1 without a significative output. Maybe I'm not using it properly.

nico_lauda gravatar imagenico_lauda ( 2016-08-03 13:06:30 -0500 )edit

use repositorie from github and try with image given. After you can use your own data

LBerger gravatar imageLBerger ( 2016-08-03 13:41:25 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2016-08-04 07:06:51 -0500

Guanta gravatar image

I'd just use feature matching in combination w. RANSAC, have a look at the following example: Your reference template looks quite small but it should still work out. Try different feature detectors/descriptor combinations.

edit flag offensive delete link more

answered 2016-08-02 21:08:52 -0500

Tetragramm gravatar image

This looks like a job for Moments, as described HERE.

You segment or threshold or whatever so that you just have the arrow, then use image moments to find the orientation. As long as there's only rotation, it should be pretty accurate.

edit flag offensive delete link more


Thank you for your answer! I tried also with moments, but I get bad results. I think this happens because there are slight differences between the template and the target in the image. I can also change the target, but i need to orient the tray always in the same way.

nico_lauda gravatar imagenico_lauda ( 2016-08-03 11:54:01 -0500 )edit

Question Tools

1 follower


Asked: 2016-08-02 16:27:08 -0500

Seen: 17,176 times

Last updated: Aug 04 '16