An improved template matching with rotation and scale invariant

While I was doing the robotic grasping research, I found out that template matching is a good approach for quick object localization but the template matching provided by OpenCV was not able to detect rotated and scaled in the match. Also it will generate many redundant matching boxes which is useless for robotic grasping. Therefore I made a few improvements on the original template matching. In my implementation, after cropping the template, I can set a range of rotate angles and scaling factors so the matching process will keep do a grid search on all possible combinations of rotate angles and scaling factors. Also, I eliminate redundancies based on the size of the template. I packed some of the new functionalities into a new function and this made the robotic grasping based on template matching robust which will not be limited to different angles and sizes.
If anyone think this is helpful, I will make a pull request to OpenCV library(a modified template matching).

@cozzyde

Good to know. Would you like to post a link to your code?

Yes, sure. But currently it is in Python: GitHub - cozheyuanzhangde/Modified-TemplateMatching: The modified OpenCV Template Matching

Hey! I just implemented a efficient NCC-based template matching algorithm with rotation invariant.
Here is the visual effect:

Get all details on this github