phaseCorrelate gives incorrect answer when input not power of 2 (Patch #1812)


Added by Jeff Mast almost 13 years ago. Updated almost 13 years ago.


Status:Done Start date:2012-04-17
Priority:Normal Due date:
Assignee:Andrey Kamaev % Done:

0%

Category:imgproc, video
Target version:2.4.1
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

The center does not appear to be computed properly when padding to optimal DFT size.
Instead of using src1 rows/cols, padded1 rows/cols should be used instead.

 1--- modules/imgproc/src/phasecorr.cpp   (revision 8074)
 2+++ modules/imgproc/src/phasecorr.cpp   (working copy)
 3@@ -556,7 +556,7 @@
 4     t = weightedCentroid(C, peakLoc, Size(5, 5));
 5
 6     // adjust shift relative to image center...
 7-    Point2d center((double)src1.cols / 2.0, (double)src1.rows / 2.0);
 8+    Point2d center((double)padded1.cols / 2.0, (double)padded1.rows / 2.0);
 9
10     return (center - t);
11 }

Associated revisions

Revision e309c514
Added by Andrey Kamaev almost 13 years ago

Fixed phaseCorrelate result for not power of 2 size images #1812 (thanks to Jeff Mast)

History

Updated by Kirill Kornyakov almost 13 years ago

  • Tracker changed from Bug to Patch
  • Description changed from The center does not appear to be computed properly when padding to optimal D... to The center does not appear to be computed properly when padding to optimal DF... More

Updated by Andrey Kamaev almost 13 years ago

Thanks for the patch!

It is applied in the OpenCV trunk.

  • Status changed from Open to Done
  • Target version set to 2.4.1
  • Description changed from The center does not appear to be computed properly when padding to optimal DF... to The center does not appear to be computed properly when padding to optimal DF... More
  • Assignee set to Andrey Kamaev

Also available in: Atom PDF