result error on matchTemplate of black image

asked 2015-12-25 06:03:56 -0600

WHHuang gravatar image

updated 2015-12-26 09:49:02 -0600

On both version 2.4.10 and 2.4.11.
Following codes are tested in Jython on Win7 64-bit

screen = Highgui.imread( "screen.png", Highgui.IMREAD_GRAYSCALE);
target = Highgui.imread( "target.png", Highgui.IMREAD_GRAYSCALE);
res = Mat();
Imgproc.matchTemplate(screen, target, res, Imgproc.TM_CCOEFF_NORMED);
print(res.get(0, 0));

The result is

array('d', [1.0])

Here [1.0] means that the matching at coordinate (0, 0) is 100%. It is incorrect.

Attached files: C:\fakepath\screen.png C:\fakepath\target.png

A similar problem is posted in DevZone
http://code.opencv.org/issues/798
It said the bug is solved.
But my codes still showed the bug.

edit retag flag offensive close merge delete

Comments

Tried it on Android with opencv 3.1.0. The result is the same.

WHHuang gravatar imageWHHuang ( 2015-12-26 05:14:44 -0600 )edit

now where is the actual error ?

berak gravatar imageberak ( 2015-12-26 09:43:49 -0600 )edit

The result array('d', [1.0]) shows that the matching is 100%. It is incorrect.

WHHuang gravatar imageWHHuang ( 2015-12-26 09:47:16 -0600 )edit