backport of master-based perf tests for matchTemplate to 2.4
Merge pull request #2384 from ilya-lavrenov:perf_match