I am reading a paper using log-gabor filters for feature detection. I was thinking about the difference between Gabor filters and log-gabor filters. Can anyone tell me the difference(s), and a way to implement them? Thanks in advance.

  • $\begingroup$ which paper was it? $\endgroup$ Jan 21 '14 at 2:09

The 1D gabor filter has the following form in the frequency domain:

$$G_{b(\sigma,\omega_0)}(\omega) = \text{exp}\left(-\frac{\sigma^2}{2}(\omega - \omega_0)^2\right)$$

The 1D log-gabor filter is:

$$G_{l(\sigma,\omega_0)}(\omega) = \text{exp}\left(-\frac{\ln^2(\omega/\omega_0)}{2\ln^2(\sigma)}\right)$$

Log-gabor filters are used because they have 0 DC component for arbitrary large bandwidth, and size distribution of features in an image is often logarithmic.

The excellent paper On the Choice of Band-Pass Quadrature Filters by Djamal Boukerroui, J. Alison Noble and Michael Brady explains further differences for these two filters as well as others.

Here is some MATLAB code for the 2D version:

[rows, cols] = size(I);

% FFT mesh
[ux, uy] = meshgrid(([1:cols]-(fix(cols/2)+1))/(cols-mod(cols,2)), ...
ux = ifftshift(ux);   % Quadrant shift to put 0 frequency at the corners
uy = ifftshift(uy);

% Convert to polar coordinates
th = atan2(uy,ux);
r = sqrt(ux.^2 + uy.^2);

% Create spectrum
filterFFT = 1.0/wavelength;
filterFFT = exp((-(log(r/filterFFT)).^2) / (2 * log(sigma)^2));
filterFFT(1,1) = 0;

% Filter image
I_filtered = real(ifft2(fft2(I) .* filterFFT));

Advantage of 0 DC

The advantage of having 0 DC component is that the response of the filter doesn't depend on the mean value of the signal. It also means you don't have an infinite impulse response. The Gabor filter has a small non-zero component around DC that is usually removed.

For feature detection, say you designed a filter kernel to match a step (1D) or edge (2D). If the filter had a DC component then the response would vary with the mean image level. e.g. consider the sobel edge detector, and the same kernel with increased values.

I = double(imread('the_image.jpg'));
I = I(:,:,1);
f1 = [[-1 0 1];...
      [-2 0 2];...
      [-1 0 1]];
f2 = [[0 3 4];...
      [1 3 5];...
      [0 3 4]];    
I1 = conv2(I,f1,'same'); images(I1); colorbar; pause;
I2 = conv2(I,f2,'same'); images(I2); colorbar; pause;
I3 = conv2(I+100,f1,'same'); images(I3); colorbar; pause;
I4 = conv2(I+100,f2,'same'); images(I4); colorbar; pause;

In this code f2 = f1 + 3. Only convolving with f1, which has 0 DC, gives the same result when the mean value of I is changed. The image responses 'look' the same, but only the 0 DC one is useful for feature detection.

  • $\begingroup$ Hi @geometrikal, what's the advantage of having a 0 DC component for a filter? $\endgroup$ Jan 27 '14 at 2:31
  • 1
    $\begingroup$ @freak_warrior I've updated answer in response to your question. $\endgroup$ Jan 27 '14 at 6:57
  • $\begingroup$ Ok, anyway how do you prove that the DC component is zero? $\endgroup$ Jan 27 '14 at 8:27
  • 1
    $\begingroup$ DC component is just the average (ie. frequency 0). So either average the spatial domain expression and check if it equals zero, or evaluate the Fourier domain expression at frequency 0 and check that is zero. $\endgroup$ Jan 27 '14 at 11:45
  • 1
    $\begingroup$ @freak_warrior Take the limit as $\omega$ goes to 0: $-\ln^2(\omega/\omega_0)$ goes to $-\infty$ and $\exp(...)$ goes to 0. $\endgroup$ Jan 27 '14 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.