Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

phasecorr.cpp function magSpectrums() DC component missed the square root operation

$
0
0
There is a possible bug in function magSpectrums(), it seems that the calculation of magnitude of DC component (the first element) is wrong, it has missed the square root operation. if( !is_1d && cn == 1 ) { for( k = 0; k < (cols % 2 ? 1 : 2); k++ ) { if( k == 1 ) dataSrc += cols - 1, dataDst += cols - 1; dataDst[0] = dataSrc[0]*dataSrc[0]; /// DC component if( rows % 2 == 0 ) dataDst[(rows-1)*stepDst] = dataSrc[(rows-1)*stepSrc]*dataSrc[(rows-1)*stepSrc]; /// DC component for( j = 1; j <= rows - 2; j += 2 ) { dataDst[j*stepDst] = (float)std::sqrt((double)dataSrc[j*stepSrc]*dataSrc[j*stepSrc] + (double)dataSrc[(j+1)*stepSrc]*dataSrc[(j+1)*stepSrc]); } if( k == 1 ) dataSrc -= cols - 1, dataDst -= cols - 1; } }

Viewing all articles
Browse latest Browse all 19555

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>