gpu::matchTemplate returns inconsistent result with cv::matchTemplate (Bug #1341)


Added by Tsung-Hsiang Chang over 13 years ago. Updated almost 13 years ago.


Status:Done Start date:
Priority:Blocker Due date:
Assignee:Anonymous % Done:

0%

Category:gpu (cuda)
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

I found two sets of images that cause gnu::matchTemplate and cv::matchTemplate return different results using CV_TM_CCOEFF_NORMED. The GPU results are even not normalized correctly.

gpu::matchTemplate(gSource,gTarget,gResult,CV_TM_CCOEFF_NORMED);
gpu::minMaxLoc(gResult, &min, &max, &min_loc, &max_loc);
cout << "gpu min: " << min << ", max: " << max << endl;
cout << "gpu min location: " << min_loc.x << "," << min_loc.y
<< ", max location: " << max_loc.x << "," << max_loc.y << endl;
matchTemplate(source,target,result,CV_TM_CCOEFF_NORMED);
minMaxLoc(result, &min, &max, &min_loc, &max_loc);
cout << "cpu min: " << min << ", max: " << max << endl;
cout << "cpu min location: " << min_loc.x << "," << min_loc.y
<< ", max location: " << max_loc.x << "," << max_loc.y << endl;

OUTPUT:
gpu min: -0.000928892, max: 4.89271
gpu min location: 0,0, max location: 2,4

cpu min: 0, max: 0.0919901
cpu min location: 0,0, max location: 4,0


source-0.png (48.7 kB) Tsung-Hsiang Chang, 2011-08-28 05:52 pm

target-0.png (506 Bytes) Tsung-Hsiang Chang, 2011-08-28 05:53 pm

source-1.png (826 Bytes) Tsung-Hsiang Chang, 2011-08-28 05:53 pm

target-1.png (1.2 kB) Tsung-Hsiang Chang, 2011-08-28 05:53 pm

testgpu.cc (1 kB) Tsung-Hsiang Chang, 2011-08-28 05:54 pm


Associated revisions

Revision 50b72197
Added by Alexey Spizhevoy over 13 years ago

fixed bug in gpu::matchTemplate (added normalization routine to make the GPU version consistent with the CPU one), added test cases from the ticket #1341

Revision d32b62a1
Added by Roman Donchenko over 11 years ago

Merge pull request #1341 from roynos:master

History

Updated by Anatoly Baksheev over 13 years ago

  • Status deleted (Open)

Updated by Anonymous over 13 years ago

Fixed.

Updated by Anonymous over 13 years ago

  • Status set to Done
  • (deleted custom field) set to fixed

Updated by Andrey Kamaev almost 13 years ago

  • Target version set to 2.4.0

Also available in: Atom PDF