Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Accuracy of OpenCV's DFT (C++ implementation)

I'm coding a with C++ and OpenCV. I'm comparing the outputs (complex numbers) of MATLAB's FFT function and OpenCV's DFT function. I am able to get identical results for normal images such as the one below (Fig. 1). However, after some processing to get the image (Fig. 2), the values are very different by orders of magnitude and I think the OpenCV's output is wrong.

Is this expected of the OpenCV's DFT function? I've tried all sorts of things like putting "DFT_SCALE" as well. Any suggestions please? Thanks!

Fig.1

Fig.2

Accuracy of OpenCV's DFT (C++ implementation)

I'm coding a with C++ and OpenCV. I'm comparing the outputs (complex numbers) of MATLAB's FFT function and OpenCV's DFT function. I am able to get identical results for normal images such as the one below (Fig. 1). However, after some processing to get the image (Fig. 2), the values are very different by orders of magnitude and I think the OpenCV's output is wrong.

Is this expected of the OpenCV's DFT function? I've tried all sorts of things like putting "DFT_SCALE" as well. Any suggestions please? Thanks!

Fig.1

Fig.2

I've also included my MATLAB code. Fig.1 is the variable assigned "S" and Fig.2 is the variable "Normin2". (product of imshow(Normin2)). Normin2 has a maximum value of 1.359 and a minimum value of -1.2667.

MATLAB code