DSPRelated.com
Forums

2D FFT cross correlation problem

Started by Unknown August 22, 2007
I'm doing 2D image cross correlation on the c6400 TI DSP. I'm using
the FFT functions in the DSP library to do this. I high pass filter my
images before correlating them using a 3x3 convolution mask. The
result seems to be correct giving a target peak in the correct
position but there is always an erroneous peak at the very centre
which does not change. Here's an image of the correlation plane with
the correct target peak slightly to the bottom right of the erroneous
centre peak.
http://img.photobucket.com/albums/v424/peterbone/corr_peak.png

Does anyone have any ideas what could be causing this? I have a
simulation of the same code in MATLAB which uses floating point
instead of fixed point and it's fine. Could it be a quantization /
scaling effect?
Thanks
Peter

On 22 Aug, 15:48, peterb...@gmail.com wrote:
> I'm doing 2D image cross correlation on the c6400 TI DSP. I'm using > the FFT functions in the DSP library to do this. I high pass filter my > images before correlating them using a 3x3 convolution mask. The > result seems to be correct giving a target peak in the correct > position but there is always an erroneous peak at the very centre > which does not change. Here's an image of the correlation plane with > the correct target peak slightly to the bottom right of the erroneous > centre peak.http://img.photobucket.com/albums/v424/peterbone/corr_peak.png > > Does anyone have any ideas what could be causing this? I have a > simulation of the same code in MATLAB which uses floating point > instead of fixed point and it's fine. Could it be a quantization / > scaling effect? > Thanks > Peter
I should add that the image is of the absolute values in the correlation plane. The target peak is always positive and the centre peak is always negative, which allows me to ignore it, but I'd still like to know what causes it. Peter
peterbone@gmail.com writes:

> I'm doing 2D image cross correlation on the c6400 TI DSP. I'm using > the FFT functions in the DSP library to do this. I high pass filter my > images before correlating them using a 3x3 convolution mask. The > result seems to be correct giving a target peak in the correct > position but there is always an erroneous peak at the very centre > which does not change. Here's an image of the correlation plane with > the correct target peak slightly to the bottom right of the erroneous > centre peak. > http://img.photobucket.com/albums/v424/peterbone/corr_peak.png > > Does anyone have any ideas what could be causing this? I have a > simulation of the same code in MATLAB which uses floating point > instead of fixed point and it's fine. Could it be a quantization / > scaling effect?
It could be an overflow, which in two's complement would cause a large positive to wrap around to full-scale negative. Are you using signed integer pixels? But I don't really think it's that because if it were the two images would be highly correlated at the center and your Matlab simulation would've found a peak there. -- % Randy Yates % "I met someone who looks alot like you, %% Fuquay-Varina, NC % she does the things you do, %%% 919-577-9882 % but she is an IBM." %%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO http://home.earthlink.net/~yatescr
On 22 Aug, 16:31, Randy Yates <ya...@ieee.org> wrote:
> peterb...@gmail.com writes: > > I'm doing 2D image cross correlation on the c6400 TI DSP. I'm using > > the FFT functions in the DSP library to do this. I high pass filter my > > images before correlating them using a 3x3 convolution mask. The > > result seems to be correct giving a target peak in the correct > > position but there is always an erroneous peak at the very centre > > which does not change. Here's an image of the correlation plane with > > the correct target peak slightly to the bottom right of the erroneous > > centre peak. > >http://img.photobucket.com/albums/v424/peterbone/corr_peak.png > > > Does anyone have any ideas what could be causing this? I have a > > simulation of the same code in MATLAB which uses floating point > > instead of fixed point and it's fine. Could it be a quantization / > > scaling effect? > > It could be an overflow, which in two's complement would cause a large > positive to wrap around to full-scale negative. Are you using signed > integer pixels? > > But I don't really think it's that because if it were the two images > would be highly correlated at the center and your Matlab simulation > would've found a peak there. > -- > % Randy Yates % "I met someone who looks alot like you, > %% Fuquay-Varina, NC % she does the things you do, > %%% 919-577-9882 % but she is an IBM." > %%%% <ya...@ieee.org> % 'Yours Truly, 2095', *Time*, ELO http://home.earthlink.net/~yatescr
Yes, the negative peak does not correspond to a strong correlation. It is always at the centre no matter what the offset of the reference image relative to the input image is. Here's a better image of the correlation plane with mid-tone grey at zero intensity showing the positive correlation peak and negative centre peak. http://img.photobucket.com/albums/v424/peterbone/corr_peak2.png Peter
On 23 Aug, 15:33, peterb...@gmail.com wrote:
> On 22 Aug, 16:31, Randy Yates <ya...@ieee.org> wrote: > > > > > peterb...@gmail.com writes: > > > I'm doing 2D image cross correlation on the c6400 TI DSP. I'm using > > > the FFT functions in the DSP library to do this. I high pass filter my > > > images before correlating them using a 3x3 convolution mask. The > > > result seems to be correct giving a target peak in the correct > > > position but there is always an erroneous peak at the very centre > > > which does not change. Here's an image of the correlation plane with > > > the correct target peak slightly to the bottom right of the erroneous > > > centre peak. > > >http://img.photobucket.com/albums/v424/peterbone/corr_peak.png > > > > Does anyone have any ideas what could be causing this? I have a > > > simulation of the same code in MATLAB which uses floating point > > > instead of fixed point and it's fine. Could it be a quantization / > > > scaling effect? > > > It could be an overflow, which in two's complement would cause a large > > positive to wrap around to full-scale negative. Are you using signed > > integer pixels? > > > But I don't really think it's that because if it were the two images > > would be highly correlated at the center and your Matlab simulation > > would've found a peak there. > > -- > > % Randy Yates % "I met someone who looks alot like you, > > %% Fuquay-Varina, NC % she does the things you do, > > %%% 919-577-9882 % but she is an IBM." > > %%%% <ya...@ieee.org> % 'Yours Truly, 2095', *Time*, ELO http://home.earthlink.net/~yatescr > > Yes, the negative peak does not correspond to a strong correlation. It > is always at the centre no matter what the offset of the reference > image relative to the input image is. Here's a better image of the > correlation plane with mid-tone grey at zero intensity showing the > positive correlation peak and negative centre peak.http://img.photobucket.com/albums/v424/peterbone/corr_peak2.png > Peter
So what can I do to remove quantization effects in fixed point FFT algorithms? Can someone point me to a link or something? Thanks Peter