Log-Gabor Filters

article/2025/9/16 13:45:44

原文转自:http://www.csse.uwa.edu.au/~pk/research/matlabfns/PhaseCongruency/Docs/convexpl.html

What Are Log-Gabor Filters and Why Are They Good?

Gabor filters are a traditional choice for obtaining localised frequency information. They offer the best simultaneous localization of spatial and frequency information. However they have two main limitations. The maximum bandwidth of a Gabor filter is limited to approximately one octave and Gabor filters are not optimal if one is seeking broad spectral information with maximal spatial localization.

An alternative to the Gabor function is the Log-Gabor function proposed by Field [1987]. Log-Gabor filters can be constructed with arbitrary bandwidth and the bandwidth can be optimised to produce a filter with minimal spatial extent.

Bandwidth limitations of Gabor filters

One cannot construct Gabor functions of arbitrarily wide bandwidth and still maintain a reasonably small DC component in the even-symmetric filter. This difficulty can be seen if we look at the transfer function of an even-symmetric Gabor filter in the frequency domain. The transfer function is the sum of two Gaussians centred at plus and minus the centre frequency. If the standard deviation of these Gaussians becomes more than about one third of the centre frequency the tails of the two Gaussians will start to overlap excessively at the origin, resulting in a nonzero DC component.

Transfer function of a high bandwidth even-symmetric Gabor filter. The two Gaussians that make up the function overlap at the origin, resulting in a significant DC component.

At the limiting situation where the centre frequency is equal to three standard deviations, the bandwidth will be approximately one octave. This can be seen as follows: For a Gaussian, the points where its value falls to half the maximum are at approximately plus and minus one standard deviation, these points defining the cutoff frequencies. Thus the upper and lower cut-off frequencies will be at approximately 4σ and 2σ respectively, giving a bandwidth of one octave. This limitation on bandwidth means that we need many Gabor filters to obtain wide coverage of the spectrum.

The Log-Gabor Filter

An alternative to the Gabor function is the log-Gabor function proposed by Field [1987]. Field suggests that natural images are better coded by filters that have Gaussian transfer functions when viewed on the logarithmic frequency scale. (Gabor functions have Gaussian transfer functions when viewed on the linear frequency scale). On the linear frequency scale the log-Gabor function has a transfer function of the form

G(w) = e  (-log(w/wo)2) / ( 2 (log(k/wo)2 )

where wo is the filter's centre frequency. To obtain constant shape ratio filters the term k/wo must also be held constant for varying wo. For example, a k/wo value of .74 will result in a filter bandwidth of approximately one octave, .55 will result in two octaves, and .41 will produce three octaves.

An example of a log-Gabor transfer function viewed on both linear and logarithmic frequency scales.

There are two important characteristics to note. Firstly, log-Gabor functions, by definition, always have no DC component, and secondly, the transfer function of the log Gabor function has an extended tail at the high frequency end. Field's studies of the statistics of natural images indicate that natural images have amplitude spectra that fall off at approximately 1/w. To encode images having such spectral characteristics one should use filters having spectra that are similar. Field suggests that log Gabor functions, having extended tails, should be able to encode natural images more efficiently than, say, ordinary Gabor functions, which would over-represent the low frequency components and under-represent the high frequency components in any encoding. Another point in support of the log Gabor function is that it is consistent with measurements on mammalian visual systems which indicate we have cell responses that are symmetric on the log frequency scale.

What do log Gabor functions look like in the spatial domain? Unfortunately due to the singularity in the log function at the origin one cannot construct an analytic expression for the shape of the log Gabor function in the spatial domain. One is reduced to designing the filters in the frequency domain and then performing a numerical inverse Fourier Transform to see what they look like. Their appearance is similar to Gabor functions though their shape becomes much `sharper' as the bandwidth is increased. The shapes of log Gabor and Gabor functions are almost identical for bandwidths less than one octave. Shown below are three log Gabor filters of different bandwidths all tuned to the same centre frequency.

Three quadrature pairs of log Gabor wavelets all tuned to the same frequency, but having bandwidths of 1, 2 and 3 octaves respectively.

Given that we are now able to construct filters of arbitrary bandwidth and zero DC component the following question arises: What is the best bandwidth to use? One observation is that as bandwidth increases so too does the sharpness of the filter. Therefore, one constraint might be imposed by the maximum sharpness of the filter that we can effectively represent. Of perhaps greater interest is to study the variation of the spatial width of filters with bandwidth. A useful objective might be to minimize the spatial width of filters in order to get maximal spatial localization of our frequency information.

Normally when a function is wide in the frequency domain it is narrow in the spatial domain, thus we expect broad bandwidth filters to be narrow in the spatial domain. However, changing the bandwidth of a log Gabor filter does not result in a simple linear stretch of its transfer function in the frequency domain, so one's first intuitive thoughts about their behaviour in the spatial domain can be misleading. Careful observation of the behaviour of broad bandwidth log Gabor filters in the spatial domain reveals that while the central spike(s) of the filter may become very narrow the tails of the filter become extended. To investigate this phenomenon further two measures of filter 'width' were studied.

  • The width required to represent 99% of the spatial filter's absolute area.
  • The second moment about the centre of the filter with respect to the absolute value of the filter.
Analytical investigation of these quantities is hampered by the singularity in the expression for the log Gabor function at the origin. Thus, the variation of both these width measures with respect to bandwidth could only be investigated numerically, and the results are shown below.
Variation of the spatial width of log Gabor functions with bandwidth (evaluated numerically).

As one can see, both measures of width are minimized when the bandwidth is about two octaves. The troughs in the curves are very broad with any value between one and three octaves achieving a near minimal spatial width. The data shown above were for even-symmetric filters. The results for odd-symmetric filters are similar though with a more gradual increase in width for bandwidths above three octaves being observed. These results have to be treated with some caution as they are vulnerable to numerical effects; the spatial form of the filters was calculated via the discrete Fourier transform, and the width measures are also determined numerically. The systematic undulations in the measure of width to represent 99% of the area are troubling; all attempts to eliminate them were unsuccessful. The magnitude of these undulations would vary with filter centre frequency but their locations would remain constant. A flaw in attempting to measure the width required to represent 99% of the filter's absolute area is that one does not know the actual area, all one knows is the total discrete area in the finite spatial window being considered. The data above was obtained using an FFT applied over 1024 points and with filters having a centre frequency of 0.05 (a wavelength of 20 units). The aim was to achieve a good discrete representation of the filter in both spatial and frequency domains, and also to avoid truncation of the filter tails. Despite the concerns one might have over the absolute accuracy of the data, it is felt that the overall trends of the curves are valid. It is interesting to note that the range of bandwidths over which filter spatial size is near minimum, 1 to 3 octaves, matches well with measurements obtained on mammalian visual cells. One should also note that the spatial width of a 3 octave log Gabor function is approximately the same as that of a 1 octave Gabor function, clearly illustrating the ability of the log Gabor function to capture broad spectral information with a compact spatial filter.


Efficient Implementation of Convolution of Log-Gabor Filters in the Frequency Domain

I am often asked how the code I use in my functions works. The code for constructing the filters and performing the convolution does appear a bit mysterious. Here's an attempt at an explanation.

In the frequency domain the even symmetric filter is represented by two real-valued log-Gaussian 'bumps' symmetrically placed on each side of the origin. The odd-symmetric filter is represented by two imaginary valued log-Gaussian 'bumps' anti-symmetrically placed on each side of the origin.

Even symmetric filter transfer function

 

Odd symmetric filter transfer function

One can combine the convolution of the even and odd symmetric filters into the one operation. Exploiting the linearity of the Fourier Transform where FFT(A+B) = FFT(A) + FFT(B) we can do the following: Multiply the FFT of the odd-symmetric filter by i (to make it real valued) and add it to the FFT of the even symmetric filter. The anti-symmetric 'bump' from the odd-symmetric filter will cancel out the corresponding symmetric bump from the even-symmetric filter. This leaves a single 'bump' (multiplied by 2) on the positive side of the frequency spectrum.

Thus if we construct a filter in the frequency domain with a single log-Gabor 'bump' on the positive side of the frequency spectrum we can consider this filter to be the sum of the FFTs of the even and odd symmetric filters (with the odd symmetric filter multiplied by i).

If we perform the convolution by multiplying this frequency domain filter by the FFT of the image and take the inverse FFT we end up with the even-symmetric convolution residing in the real part of the result and the odd-symmetric convolution residing in the imaginary part.

Returning the result in this form is very convenient. With the complex values of the the convolution result simultaneously encoding the magnitude and phase response of the quadrature filters.

2D Filter Construction

Following describes extracts of code in  phasecong2 .

The first step is to compute a matrix the same size as the image where every value of the matrix contains the normalised radius from the centre on the matrix. Values range from 0 at the middle to 0.5 at the boundary.

  [x,y] = meshgrid([-cols/2:(cols/2-1)]/cols,...[-rows/2:(rows/2-1)]/rows);radius = sqrt(x.^2 + y.^2);       % Matrix values contain *normalised* radius % values ranging from 0 at the centre to % 0.5 at the boundary.radius(rows/2+1, cols/2+1) = 1;   % Get rid of the 0 radius value in the middle % so that taking the log of the radius will % not cause trouble.
Filters are constructed in terms of two components.
  1. The radial component, which controls the frequency band that the filter responds to
  2. The angular component, which controls the orientation that the filter responds to.
The two components are multiplied together to construct the overall filter.

Here is an example of constructing the radial component of the filter given some desired filter wavelength. The bandwidth of the filter is controlled by the parameter sigmaOnf.

  fo = 1.0/wavelength;                  % Centre frequency of filter.% The following implements the log-gabor transfer function.logGabor = exp((-(log(radius/fo)).^2) / (2 * log(sigmaOnf)^2));  logGabor(rows/2+1, cols/2+1) = 0;     % Set the value at the 0 frequency point % of the filter back to zero % (undo the radius fudge).

Radial log-Gabor component of the filter.

A problem is that for small wavelengths the filters can extend into the higher frequencies in the 'corners' of the FFT, whereas in the vertical and horizontal directions the filters are cut off by the boundary. This uneven coverage depending on direction can upset the normalisation process when calculating phase congrunecy. To make the coverage uniform in all directions the filters are multiplied by a low-pass filter that is as large as possible, yet falls away to zero at the boundaries. For most filter scales, other than the highest frequency ones, this has no appreciable effect on the filter. Note the application of the low pass filter is only implemented in phasecong2 (so far).
  lp = lowpassfilter([rows,cols],.4,10);   % Radius .4, 'sharpness' 10logGabor = logGabor.*lp;                 % Apply low-pass filter

Large low-pass filter.


Product of low-pass filter and log-Gabor filter (in this case it does nothing).

Now we calculate the angular component that controls the orientation selectivity of the filter. This is simply a Gaussian with respect to the polar angle around the centre. The Gaussian is centred at some angle  angl , and has standard deviation  thetaSigma .
  theta = atan2(-y,x);              % Matrix values contain polar angle.% (note -ve y is used to give +ve% anti-clockwise angles)sintheta = sin(theta);costheta = cos(theta);% For each point in the filter matrix calculate the angular distance from the% specified filter orientation.  To overcome the angular wrap-around problem% sine difference and cosine difference values are first computed and then% the atan2 function is used to determine angular distance.ds = sintheta * cos(angl) - costheta * sin(angl);    % Difference in sine.dc = costheta * cos(angl) + sintheta * sin(angl);    % Difference in cosine.dtheta = abs(atan2(ds,dc));                          % Absolute angular distance.spread = exp((-dtheta.^2) / (2 * thetaSigma^2));     % Calculate the angular % filter component.filter = spread.*logGabor;                           % Product of the two components.

Angular component of the filter.


Product of angular and radial components to produce the frequency domain representation of the log-Gabor filter.

If we take the inverse Fourier Transform of this filter the even-symmetric component will be in the real part of the result and odd-symmetric component will be in the imaginary part of the result.

Even symmetric filter.

Odd symmetric filter.

To create filters tuned to other frequencies and oriented in different directions one simply forms the product between the appropriate radial and angular spread components - mix and match.


Design of a Log-Gabor Filter Bank

A Gabor, or log-Gabor, filter bank does not form an orthogonal basis set and hence there is no unique or ideal arrangement of the filters. Thus, the design of a filter bank is somewhat of an art but the following should give you some guidelines.

One aim is to produce a filter bank that provides even coverage of the section of the spectrum that you wish to represent. This can be achieved by making the overlap of the filter transfer functions sufficiently large so that when one sums the individual transfer functions the net result is an even coverage of the spectrum. Thus, every point in the spectrum ends up being represented equally in the final result. For computational reasons one wants to achieve this even coverage of the spectrum with a minimal number of filters.

A second aim, which conflicts with the first, is to ensure the outputs of the individual filters in the bank are as independent as possible. The whole aim of applying the filter bank is to obtain information about our signal, if a filter's outputs are highly correlated with those of its neighbours then we have an inefficient arrangement of filters that do not provide as much information as they should. To achieve independence of output the filters should have minimal overlap of their transfer functions.

Thus the transfer functions of our filters should have the minimal overlap necessary to achieve fairly even spectral coverage.

Here are the parameters you have to decide on, several are interdependent.

  • The minimum and maximum frequencies you wish to cover.
  • The filter bandwidth to use.
  • The scaling between centre frequencies of successive filters.
  • The number of filter scales.
  • The number of filter orientations to use.
  • The angular spread of each filter.

Maximum frequency

The maximum frequency is set by the wavelength of the smallest scale filter, this is controlled by the parameter minWaveLength. The smallest value you can sensibly use here is the Nyquist wavelength of 2 pixels, however at this wavelength you will get considerable alaising and I prefer to keep the minimum value to 3 pixels or above.

Minimum frequency

The minimum frequency is set by the wavelength of the largest scale filter. This is implicitly defined once you have set the number of filter scales (nscale), the scaling between centre frequencies of successive filters (mult), and the wavelength of the smallest scale filter.

   maximum wavelength = minWavelength * mult^(nscale-1)minimum frequency = 1 / maximum wavelength

Filter bandwidth

The filter bandwidth is set by specifying the ratio of the standard deviation of the Gaussian describing the log Gabor filter's transfer function in the log-frequency domain to the filter center frequency. This is set by the parameter sigmaOnf . The smaller sigmaOnf is the larger the bandwidth of the filter. I have not worked out an expression relating sigmaOnf to bandwidth, but empirically a sigmaOnf value of 0.75 will result in a filter with a bandwidth of approximately 1 octave and a value of 0.55 will result in a bandwidth of roughly 2 octaves.

Scaling between centre frequencies

Having set a filter bandwidth one is then in a position to decide on the scaling between centre frequencies of successive filters (mult). It is here one has to play off the conflicting demands of even spectral coverage and independence of filter output.

Here is a table of values, determined experimentally, that result in the minimal overlap necessary to achieve fairly even spectral coverage.

 sigmaOnf  .85   mult 1.3sigmaOnf  .75   mult 1.6     (bandwidth ~1 octave)sigmaOnf  .65   mult 2.1sigmaOnf  .55   mult 3       (bandwidth ~2 octaves)

The number of filter orientations

This, in conjunction with the angular spread of each filter, specifies the resolution of the orientation information you obtain from the filters. I have traditionally used six orientations.

The angular spread of each filter

Here again one plays off the demands of even spectral coverage and independence of filter output. The angular interval between filter orientations is fixed by the number of filter orientations. In the frequency domain the spread of 2D log-Gabor filter in the angular direction is simply a Gaussian with respect to the polar angle around the centre. The angular overlap of the filter transfer functions is controlled by the ratio of the angular interval between filter orientations and the standard deviation of the angular Gaussian spreading function. Within the code this ratio is controlled by the parameter  dThetaOnSigma . A value of  dThetaOnSigma  = 1.5 results in approximately the minimum overlap needed to get even spectral coverage.

http://chatgpt.dhexx.cn/article/nnwv05UH.shtml

相关文章

Gabor

出处:http://zhenyulu.cnblogs.com/articles/325968.html 二、Gabor函数 Gabor变换属于加窗傅立叶变换,Gabor函数可以在频域不同尺度、不同方向上提取相关的特征。另外Gabor函数与人眼的生物作用相仿,所以经常用作纹理识别上,并取…

Gabor滤波器与特征提取

一、Gabor滤波器 Gabor滤波器,最主要使用优势体现在对物体纹理特征的提取上。 二维Gabor基函数能够很好地描述哺乳动物初级视觉系统中一对简单视觉神经元的感受野特性。随着小波变换和神经生理学的发展,Gabor变换逐渐演变成二维Gabor小波的形式。Gabor…

【图像处理】Gabor滤波器

Gabor的核函数参考的wiki 使用实数Real的公式计算核函数代码&#xff1a; Mat getGaborFilter(float lambda, float theta, float sigma2,float gamma, float psi 0.0f){if(abs(lambda-0.0f)<1e-6){lambda 1.0f;} float sigma_x sigma2;float sigma_y sigma2/(gamma*gam…

生物特征识别中的Gabor滤波器

Daugman&#xff08;1980&#xff09;提出的2D Gabor滤波器&#xff08;以下简称Gabor滤波器&#xff09;&#xff0c;在纹理分类、纹理分割、生物特征识别中取得了广泛的应用。本文首先简要介绍Gabor滤波器&#xff0c;然后列举它在生物特征识别方面的代表性应用。 2D Gabor滤…

matlab的gabor类解读

为什么要进行解析&#xff0c;因为自带的gabor函数有个小坑&#xff0c; 转opencv的时候&#xff0c;因为没有完全理解自带的gabor源码被小小的坑了一下&#xff0c; 所以做一下记录&#xff0c; 以方便后人。‘ 版本是2016B 文章目录 Matlab gabor函数解析1 gabor基本公式2 m…

Gabor滤波 + 多尺度问题

Gabor函数 Gabor变换属于加窗傅立叶变换&#xff0c;Gabor函数可以在频域不同尺度、不同方向上提取相关的特征。另外Gabor函数与人眼的生物作用相仿&#xff0c;所以经常用作纹理识别上&#xff0c;并取得了较好的效果。二维Gabor函数可以表示为&#xff1a; 其中&#xff1a;…

Gabor算法

在数字图像处理领域&#xff0c;Gabor滤波器是以Dennis Gabor命名的&#xff0c;Gabor滤波器是用作边缘检测的线性滤波器。Gabor滤波器的频率和方向的表达与人类的视觉系统很相似。研究发现&#xff0c;Gabor滤波器非常适合纹理表达和分离。在空间域中&#xff0c;一个二维Gabo…

Log-Gabor滤波器

Log-Gabor滤波器 G ( f ) e l n 2 ( ω / ω 0 ) 2 l n 2 ( k / ω 0 ) G(f)e^{\frac {ln^2({\omega /\omega_0})}{2{ln}^2(k/\omega_0)}} G(f)e2ln2(k/ω0​)ln2(ω/ω0​)​ 式中&#xff1a; ω 0 \omega_0 ω0​为滤波器中心频率&#xff0c;通常将 k / ω 0 k/\omega_0 k…

Gabor滤波器原理

一、什么是Gabor函数&#xff08;以下内容含部分翻译自维基百科&#xff09; 在图像处理中&#xff0c;Gabor函数是一个用于边缘提取的线性滤波器。Gabor滤波器的频率和方向表达同人类视觉系统类似。研究发现&#xff0c;Gabor滤波器十分适合纹理表达和分离。在空间域中&#x…

Gabor的OpenCV代码

唯一持续维护地址&#xff1a;http://52coding.com/opencv-gabor 最近弄人脸识别&#xff0c;用到Gabor卷积核&#xff0c;但网上的代码似乎没有和我心意的&#xff0c;于是参考了自己写了下&#xff01;参考了Zhou Mian以及matlab的Gabor实现代码的代码。虽然OpenCV的imporc下…

2021-08-07 Gabor滤波器简介以及简单应用

Gabor滤波器&#xff08;Gabor Filter&#xff09; 文章目录 Gabor滤波器&#xff08;Gabor Filter&#xff09;简介Gabor滤波器的不同参数Gabor滤波器的简单应用&#xff08;python&#xff09; 简介 Gabor滤波器是一种线性滤波器&#xff0c;用于边缘检测、纹理分析、特征提…

Gabor Filters

Gabor Filters: Manjunath, B. S., & Ma, W. Y. (1996). Texture features for browsing and retrieval of image data. IEEE Transactions on Pattern Analysis and Machine Intelligence, 18(8), 837-842. Gabor滤波器是一种基于Gabor函数的特定频率和方向选择性滤波器。…

基于Gabor滤波器的人脸特征提取

Gabor小波变换的核函数&#xff0c;其最大的特点是其与人脑的皮层神经细胞的二维反射区具有相似的特征。基于Gabor小波变换的特征信息能够有效提取各种细节结构信息&#xff0c;因此Gabor小波变换在图像识别领域有着较为广泛的应用。根据Gabor小波变换的特点&#xff0c;基于Ga…

Gabor特征提取

Gabor小波与人类视觉系统中简单细胞的视觉刺激响应非常相似。它在提取目标的局部空间和频率域信息方面具有良好的特性。虽然Gabor小波本身并不能构成正交基&#xff0c;但在特定参数下可构成紧框架。Gabor小波对于图像的边缘敏感&#xff0c;能够提供良好的方向选择和尺度选择特…

Gabor 卷积神经网络

与不涉及学习过程的 hand-crafted 滤波器不同&#xff0c;DCNNs-based feature extraction 是一种 data-driven 技术&#xff0c;可以直接从数据中学习具有鲁棒性的特征表示。然而&#xff0c;它有非常大的训练成本和复杂的模型参数。 DCNNs 有限的几何变换建模能力主要来自于…

如何理解Gabor滤波器

转载自如何理解Gabor滤波器 介绍 我们已经知道&#xff0c;傅里叶变换是一种信号处理中的有力工具&#xff0c;可以帮助我们将图像从空域转换到频域&#xff0c;并提取到空域上不易提取的特征。但是经过傅里叶变换后&#xff0c;图像在不同位置的频度特征往往混合在一起&…

基于python的图像Gabor变换及特征提取

基于python的图像Gabor变换及特征提取 1.前言2. “Gabor帮主”简介3.“Gabor帮主”大招之图像变换3.“Gabor帮主”大招之图像特征提取 深圳中兴网信科技有限公司&#xff1a;廖海斌 1.前言 在深度学习出来之前&#xff0c;图像识别领域北有“Gabor帮主”&#xff0c;南有“SIF…

Gabor滤波器详解

转载自如何理解Gabor滤波器 介绍 我们已经知道&#xff0c;傅里叶变换是一种信号处理中的有力工具&#xff0c;可以帮助我们将图像从空域转换到频域&#xff0c;并提取到空域上不易提取的特征。但是经过傅里叶变换后&#xff0c;图像在不同位置的频度特征往往混合在一起&…

Gabor 变换

http://blog.sina.com.cn/s/blog_48a242d601000a3j.html Gabor变换属于加窗傅立叶变换&#xff0c;Gabor函数可以在频域不同尺度、不同方向上提取相关的特征。另外Gabor函数与人眼的生物作用相仿&#xff0c;所以经常用作纹理识别上&#xff0c;并取得了较好的效果。 Gabor变换…

图像处理:Gabor滤波器简介以及python实现

在图像处理中&#xff0c;以Dennis Gabor命名的Gabor滤波器是一种用于纹理分析的线性滤波器&#xff0c;本质上是指在分析点或分析区域周围的局部区域内&#xff0c;分析图像中是否存在特定方向的特定频率内容。Gabor滤波器的频率和方向表示被许多当代视觉科学家认为与人类视觉…