OpenCV's matchTemplate tutorial code not giving expected results
Hi!
I've been having troubbles with OpenCV's matchTemplate function. The probability map that I got when runnin my code didn't seem correct to me.
I decided to code a test to ensure that I would get the same behavior than opencv's binary example "cpp-tutorial-MatchTemplate_Demo" with the images given in the online tutorial (the couple in a plane).
That's when I realized that the example code doesn't give me the expected results either.. Here are some screenshots of the template matching ran with the example code and example pictures
I compiled OpenCV myself, after checking out the tag 3.2.0 I don't think I changed much of the cmake settings, except for WITH_QT=ON
I am recompiling with BUILD_TESTS=ON, maybe it'll bring additional information, if there's a unit test on it. I am looking forward to your input on this issue!
I'm running Arch Linux (Linux cerberus 4.12.8-2-ARCH #1 SMP PREEMPT Fri Aug 18 14:08:02 UTC 2017 x86_64 GNU/Linux)
where is your code, and why do you think, the results are incorrect?
(also, it would be nice, if you could put your images here , not behind some urlshortened thing, where noone knows, where it's leading.)
Sorry for the pictures, they were uploaded on ImgBB. I rectified. As for the code, I didn't code anything here. My issue is directly with the Template matching demo code that is embedded in OpenCV's git repository and compiled with the sources when enabling samples in CMake. As for the pictures I used, I took them on this Opencv tutorial page. And I know that the results are incorrect since the tutorial shows completely different probability maps with the same inputs and the same code.
ok, i'm getting the same results on win. not nice.
I have a colleague who told me he doesn't have this problem. I'll write down here his version of opencv, linux, and compile options as soon as he answers. In the meantime, I checked out 3.1.0 and got the same issue. I updated master and recompiled, and again, same issue... :/
lots of complaints, lately
It looks like TM_CCORR is wrong too. And that eliminates a lot of the possible errors, since it only uses the crossCorr function, and not the common_matchTemplate.
Hmm, the only change I see it the HAL DFT.
EDIT: Nope, that's not it. So maybe I just picked a bad image to test? SQDIFF works, and the others fail...
EDIT2: I just tested a whole bunch of images and SQDIFF is the only one that works. CCORR and CCOEFF both fail every time.
I don't have the issue on ubuntu 17.04 with opencv 3.0.0. Though, on Arch linux, with the same version (git checkout 3.0.0) I get the same problem. I compiled with the same version of gcc (5.4), with the same cmake options... For me none of the method succeed (SQDIFF / CCOEF / CCORR..)
Have you tried with openCL and IPP turned off?
IPP OFF ; OpenCL OFF -> same result.. :(