MatchTemplate problem for rotated image

asked 2017-05-19 16:50:55 -0600

third112 gravatar image

Hi,

I need to find template image in source image. The template may be rotated by any angle. It seems that simple MatchTemplate example does not work in this case. For example, let template be letter "A". I copy "A" to source image and rotate the "A"...

edit retag flag offensive close merge delete

Comments

No it does not work because fourier transform is not invariant by rotation...you mya use this

LBerger gravatar imageLBerger ( 2017-05-20 02:13:53 -0600 )edit

Ok. Thank you. Are there functions to realize this approach in openCV?

third112 gravatar imagethird112 ( 2017-05-20 04:54:33 -0600 )edit

No but I think this can help you

LBerger gravatar imageLBerger ( 2017-05-20 05:45:13 -0600 )edit

Thank you. The code looks like very helpful, however perhaps my task may be solved via more simple way. I develop game bot for Space Rangers 2. The bot has to find followed 8 templates templates.jpg in screenshort. I.e. the object to search may be rotated by 45 degrees. I have following results: result.jpg Have you any idea to improve the recognition?

third112 gravatar imagethird112 ( 2017-05-21 17:48:13 -0600 )edit

Something looks wrong. If you have 8 template can you try match template using this 8 template?

LBerger gravatar imageLBerger ( 2017-05-22 01:23:10 -0600 )edit

Sorry, I do not understand your idea exactly :(

third112 gravatar imagethird112 ( 2017-05-22 06:17:04 -0600 )edit