Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

result error on matchTemplate of black image

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])

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.

result error on matchTemplate of black image

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.