I recently recompiled OpenCV 3.2.0 on my Ubuntu 16.04 machine to include CUDA. For some reason, the cv::dft() now takes about 30 seconds for a certain image instead of 5 seconds before compilation. This is catastrophic as I need to run it a lot of times. What could be the reason for this change? Are there some compiler flags I might have missed?
Asked
Active
Viewed 96 times
1
-
1OpenCV has a simple dft implementation or can use FFTW library (which is very fast and the industry reference for Fourier computation). This is the first thing I would look at (it is a CMAKE option). See also https://stackoverflow.com/questions/10436673/fftw-vs-opencv-cvdft – ypnos Sep 26 '18 at 10:54
-
I ran `locate *fftw*.so` and it returns only `libcufftw`. So apparently I hadn't installed it before either, but I'll try it out now, thanks! – smcs Sep 26 '18 at 11:03
-
I think it might have to do with the `IPP` flag. From https://software.intel.com/en-us/ipp-dev-reference-discrete-fourier-transform-functions: `The DFT is less efficient than the fast Fourier transform, however the length of the vector transformed by the DFT can be arbitrary.` I didn't use padding on the image so compiling without IPP might have made it massively slower. – smcs Sep 27 '18 at 12:16
1 Answers
1
I can't say for sure but it seems the necessary flag that I had not activated was WITH_IPP=ON
. DFT now runs ten times faster, after I recompiled.
As a side note, padding can make a huge difference as well, as explained here: https://docs.opencv.org/2.4/doc/tutorials/core/discrete_fourier_transform/discrete_fourier_transform.html

smcs
- 1,772
- 3
- 18
- 48