Hi all, I am doing 2D image filtering with sometimes filter size larger than image size. I am wondering which of the following scheme is the fastest, using Matlab: 1) conv2, 2D convolution directly; 2) conv2, but decompose the filter into two separable filters and then conv2 will first convolve along X axis and then convolve along Y axis; 3) fft2, multiplication, ifft2, all in 2D domain; 4) fft, multiplication, ifft, all in 1D case and work on convolutions of separable filters along X axis and Y axis; (similar to 2, but do 1D convolution all in frequency domain). Images and filters are typically hundreds and thousands of pixels, is FFT method always faster? 2D FFT or use 1D separable FFT? Thanks
when to use "conv2", when to use "fft"->"multiplication"->"ifft"?
Started by ●February 19, 2005
Reply by ●February 19, 20052005-02-19
Why not just trying and pick the fastest one for you ? For 2D FFT, and 1D separable FFT ... if you are using Matlab, I think 2D FFT is a little faster. If you are using C library, the performance should be very very close. Regards, KC
Reply by ●February 19, 20052005-02-19
>I am wondering which of the following scheme is the fastest, using Matlab: > >1) conv2, 2D convolution directly; >2) conv2, but decompose the filter into two separable filters and then conv2 >will first convolve along X axis and then convolve along Y axis; >3) fft2, multiplication, ifft2, all in 2D domain; >4) fft, multiplication, ifft, all in 1D case and work on convolutions of >separable filters along X axis and Y axis; (similar to 2, but do 1D >convolution all in frequency domain).AFIK, Matlab's conv2 uses FFT/Multiply/IFFT when sizes are powers of 2. Don't quote me on that though. You should find conv2 is about the same speed as the FFT route. A