Template Matching
Summary
openCV template matching, java 8, javacpp-presets, gradle
Description
The solution is almost a shameless rip-off of openCV tutorial
Assumptions
-
Template is smaller than the image (both dimensions)
-
On wrong parameters, exception with a message is thrown
Possible improvements
Still false positives happen. Resized templates are not detected.
Potential optimization and future experiments:
-
reduce false positives: on found template use phash / compare histograms / features detection
-
find resized, distorted templates: maybe some kind of sliding window with phash
Build & Run
build
./gradlew build
run
java -jar build/libs/template-match-all.jar image1 image2
Tested on ubuntu 14.04 and docker openjdk:8. Although on alpine it failed due to problems with loading native openCV libs.