Gabor特征码分析

转载请注明出处
The Gabor filter, named after Dennis Gabor, is a linear filter used in myriad of image processing application for edge detection, texture analysis, feature extraction, etc. The characteristics of certain cells in the visual cortex of some mammals can be approximated by these filters. These filters have been shown to possess optimal localization properties in both spatial and frequency domain and thus are well suited for texture segmentation problems. Gabor filters are special classes of band pass filters, i.e., they allow a certain ‘band’ of frequencies and reject the others. A Gabor filter can be viewed as a sinusoidal signal of particular frequency and orientation, modulated by a Gaussian wave. One such 2D Gabor filter is shown in the figure 1.

以Dennis Gabor命名的Gabor滤波器是一种线性滤波器,在无数的图像处理应用中用于边缘检测、纹理分析、特征提取等。一些哺乳动物的视觉皮层中的某些细胞的特征可以用这些滤波器来近似描述。这些滤波器已被证明在空间和频率域都具有最佳的定位特性,因此很适合用于纹理分割问题。Gabor滤波器是特殊类别的带通滤波器,也就是说,它们允许某个 “带 “的频率,而拒绝其他的频率。一个Gabor滤波器可以被看作是一个具有特定频率和方向的正弦信号,由高斯波调制。一个这样的二维Gabor滤波器如图1所示。

Gabor特征码分析

Figure 1: A 2-D Gabor filter obtained by modulating the sine wave with a Gaussian
From the above figure we can notice that the sinusoid has been spatially localized. In practice to analyze texture or obtain feature from image, a bank of Gabor filter with number of different orientation are used.

从上图中我们可以注意到,正弦波已经被空间定位了。在实践中,为了分析纹理或从图像中获取特征,我们使用了一些不同方向的Gabor滤波器组。

Consider an example of elephant which has pattern or stripes on its skin at different orientation. Now to highlight or extract out all those patterns we are going to use a bank of 16 Gabor filters at an orientation of 11.250 (i.e. if the first filter is at 00, then the second will be at 11.250, the third will be at 22.50, and so on.).The figure 2 shows all the filter bank of 16 filters

考虑一个大象的例子,它的皮肤上有不同方向的图案或条纹。现在,为了突出或提取所有这些图案,我们将使用一个由16个Gabor滤波器组成的银行,其方向为11.250(即如果第一个滤波器是在00,那么第二个将在11.250,第三个将在22.50,以此类推)。

Gabor特征码分析

Figure 2: A bank of 16 Gabor filter oriented at an angle of 11.250 (i.e. if the first filter is at 00, then the second will be at 11.250, the third will be at 22.50, and so on.)

When the input image is convolved with all the Gabor filters the patterns are easily highlighted as shown in figure 3. When a Gabor filter is applied to an image, it gives the highest response at edges and at points where texture changes. When we say that a filter responds to a particular feature, we mean that the filter has a distinguishing value at the spatial location of that feature.

当输入的图像与所有的Gabor滤波器进行卷积时,图案很容易被突出,如图3所示。当一个Gabor滤波器被应用到图像上时,它在边缘和纹理变化点上的反应最高。当我们说一个滤波器对某一特定特征有反应时,我们的意思是该滤波器在该特征的空间位置有一个区分值。

Gabor特征码分析

Figure 3: (a) The input image of an Elephant and (b) the output image after passing it through the Gabor filter bank

To better understand what each filters detect in input image, consider a simple white circle in black background. When this image is passed through each filter in the filter bank, the edge of the circle which gets detected is the edge oriented at an angle at which the Gabor filter is oriented. The Figure 4 clearly shows this.

为了更好地理解每个滤波器对输入图像的检测,考虑一个黑色背景下的简单的白色圆圈。当这个图像通过滤波器组中的每个滤波器时,被检测到的圆的边缘是以Gabor滤波器的角度为导向的边缘。图4清楚地显示了这一点。

Gabor特征码分析

Figure 4: The corresponding oriented edge features being detected when passed through individual oriented Gabor filters

Different parameters that controls the shape & size of 2D Gabor filter:

控制二维Gabor滤波器的形状和大小的不同参数。

There are certain parameters that controls how Gabor filter will be and which features will it respond to. A 2D Gabor filter can be viewed as a sinusoidal signal of particular frequency and orientation, modulated by a Gaussian wave. The filter has a real and an imaginary component representing orthogonal directions. The two components may be formed into a complex number or used individually. The equations are shown below:

有一些参数可以控制Gabor滤波器的表现以及它对哪些特征的反应。一个二维Gabor滤波器可以被看作是一个特定频率和方向的正弦信号,由高斯波调制。滤波器有一个实部和一个虚部,代表正交方向。这两个分量可以组成一个复数或单独使用。方程显示如下。

Gabor特征码分析

In the above equation,
λ — Wavelength of the sinusoidal component.

Ө — The orientation of the normal to the parallel stripes of Gabor function.

Ψ — The phase offset of the sinusoidal function.

σ — The sigma/standard deviation of the Gaussian envelope
ɣ — The spatial aspect ratio and specifies the ellipticity of the support of Gabor function.

The above mentioned five parameters controls the shape and size of the Gabor function. The role of each parameter is discussed in detail below.For illustration of the effects of parameters, following values are chosen as starting point:
Lambda (λ) = 30; Theta (Ө) = 00
Gamma (ɣ) = 0.25; Sigma (σ) = 10
Psi (Ψ) = 0
Lambda (λ):
The wavelength governs the width of the strips of Gabor function. Increasing the wavelength produces thicker stripes and decreasing the wavelength produces thinner stripes. Keeping other parameters unchanged and changing the lambda to 60 and 100, the stripes gets thicker.

在上面的方程式中。
λ – 正弦波分量的波长。
Ө – Gabor函数平行条纹的法线方向。
Ψ – 正弦波函数的相位偏移。
σ – 高斯包络的西格玛/标准偏差。
ɣ – 空间纵横比,指定Gabor函数支持的椭圆度。
以上提到的五个参数控制着Gabor函数的形状和大小。下面将详细讨论每个参数的作用。为了说明参数的作用,我们选择以下数值作为起点。
Lambda(λ)=30;Theta(Ө)=00
Gamma (ɣ) = 0.25; Sigma (σ) = 10
Psi (Ψ) = 0
兰姆达(λ)。
波长决定了Gabor函数条带的宽度。增加波长产生较粗的条纹,减少波长产生较细的条纹。在保持其他参数不变的情况下,将λ改为60和100,条纹会变粗。

Gabor特征码分析

Figure 1: Keeping other parameters unchanged (Ө = 00, ɣ = 0.25, σ = 10, Ψ = 0), and on changing the lambda from 30 to 60 and 100 the Gabor function gets thicker

Theta (Ө):
The theta controls the orientation of the Gabor function. The zero degree theta corresponds to the vertical position of the Gabor function.

Theta控制Gabor函数的方向。零度的theta对应于Gabor函数的垂直位置。

Gabor特征码分析

Figure 2: Keeping other parameters unchanged (λ = 30, ɣ = 0.25, σ = 10, Ψ = 0), and on changing the theta from 00 to 450 and 900 the Gabor function rotates.

Gamma (ɣ):
The aspect ratio or gamma controls the height of the Gabor function. For very high aspect ratio the height becomes very small and for very small gamma value the height becomes quite large. On increasing the value of gamma to 0.5 and 0.75, keeping other parameters unchanged, the height of the Gabor function reduces.

长宽比或伽马值控制着Gabor函数的高度。对于非常高的长宽比,高度变得非常小,而对于非常小的gamma值,高度变得相当大。当伽马值增加到0.5和0.75时,保持其他参数不变,Gabor函数的高度会降低。

Gabor特征码分析

Figure 3: Keeping other parameters unchanged (λ = 30, Ө = 00, σ = 10, Ψ = 0), and on changing the gamma from 0.25 to 0.5 and 0.75, the Gabor function gets shorter.

Sigma (σ):
The bandwidth or sigma controls the overall size of the Gabor envelope. For larger bandwidth the envelope increase allowing more stripes and with small bandwidth the envelope tightens. On increasing the sigma to 30 and 45, the number of stripes in the Gabor function increases.

带宽或西格玛控制着Gabor包络的整体大小。对于较大的带宽来说,包络的增加允许更多的条纹,而对于小带宽来说,包络会变紧。当西格玛增加到30和45时,Gabor函数中的条纹数量会增加。

Figure 4: Keeping other parameters unchanged (λ = 30, Ө = 00 ɣ = 0.25, Ψ = 0), and on changing the sigma from 10 to 30 and 45 the number of stripes in Gabor function increases.

Gabor特征码分析

In OpenCV Python, following is the structure of the function that is used to create a Gabor kernel.

cv2.getGaborKernel(ksize, sigma, theta, lambda, gamma, psi, ktype)

ksize is the size of the Gabor kernel. If ksize = (a, b), we then have a Gabor kernel of size a x b pixels. As with many other convolution kernels, ksize is preferably odd and the kernel is a square (just for the sake of uniformity).

sigma is the standard deviation of the Gaussian function used in the Gabor filter.

theta is the orientation of the normal to the parallel stripes of the Gabor function.

lambda is the wavelength of the sinusoidal factor in the above equation.

gamma is the spatial aspect ratio.

psi is the phase offset.

ktype indicates the type and range of values that each pixel in the Gabor kernel can hold.

Experiment
Lambda (wavelength)- Controls the width of the strips of gabor function. Decreasing the wavelength produces thinner stripes
Theta(Orientation): governs the rotation of the gabor envelope
Gamma(aspect Ratio): controls the height of the Gabor filter. If the gamma value is the height of gabor reduces and if the gamma value is small the height of gabor increases.

Sigma (Bandwidth) : It controls the overall size of the Gabor envelope . for larger bandwidth the envelope increase allowing more stripes and with smaller bandwidth the envelope tightens.

Psi-is the phase offset of sinusoid.

在OpenCV Python中,以下是用于创建Gabor内核的函数结构。
cv2.getGaborKernel(ksize, sigma, theta, lambda, gamma, psi, ktype)
ksize是Gabor核的大小。如果ksize = (a, b),我们就有一个大小为a x b像素的Gabor核。与其他许多卷积核一样,ksize最好是奇数,核是正方形(只是为了统一)。
sigma是Gabor滤波器中使用的高斯函数的标准偏差。
theta是Gabor函数的平行条纹的法线方向。
lambda是上式中正弦波因子的波长。
gamma是空间纵横比。
psi是相位偏移。
ktype表示Gabor核中每个像素可容纳的数值的类型和范围。
实验
Lambda(波长)–控制Gabor函数条的宽度。减少波长会产生更细的条纹
Theta(方向):控制gabor包络的旋转。
Gamma(长宽比):控制Gabor滤波器的高度。如果gamma值是,gabor的高度就会降低,如果gamma值小,gabor的高度就会增加。
Sigma(带宽):它控制Gabor包络的整体大小。带宽越大,包络越大,允许更多的条纹,带宽越小,包络越紧。
Psi-是正弦波的相位偏移。

Original: https://blog.csdn.net/cattleDrinkRedWine/article/details/122366154
Author: CattleDrinkRedWine
Title: Gabor特征码分析

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/645707/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球