Study/Image_processing - 해당되는 글 4건
크리에이티브 커먼즈 라이선스
Creative Commons License

Explanation of parameters

Gabor filtering

This block implements one or multiple convolutions of an input image with a two-dimensional Gabor function:

equation 1.1

To visualize a Gabor function select the option "Gabor function" under "Output image". The Gabor function for the specified values of the parameters "wavelength", "orientation", "phase offset", "aspect ratio", and "bandwidth" will be calculated and displayed as an intensity map image in the output window. (Light and dark gray colors correspond to positive and negative function values, respectively.) The image in the output widow has the same size as the input image: select, for instance, input image octagon.jpg to get an output image of size 100 by 100. If lists of values are specified under "orientation(s)" and "phase offset(s)", only the first values in these lists will be used.

Two-dimensional Gabor functions were proposed by Daugman [1] to model the spatial summation properties (of the receptive fields) of simple cells in the visual cortex. They are widely used in image processing, computer vision, neuroscience and psychophysics. The parametrisaton used in Eq.(1) follows references [2-7] where further details can be found.



Wavelength (λ)

This is the wavelength of the cosine factor of the Gabor filter kernel and herewith the preferred wavelength of this filter. Its value is specified in pixels. Valid values are real numbers equal to or greater than 2. The value λ=2 should not be used in combination with phase offset φ=-90 or φ=90 because in these cases the Gabor function is sampled in its zero crossings. In order to prevent the occurence of undesired effects at the image borders, the wavelength value should be smaller than one fifth of the input image size.


The images (of size 100 x 100) on the left show Gabor filter kernels with values of the wavelength parameter of 5, 10 and 15, from left to right, respectively. The values of the other parameters are as follows: orientation 0, phase offset 0, aspect ratio 0.5, and bandwidth 1.


Orientation(s) (θ)

This parameter specifies the orientation of the normal to the parallel stripes of a Gabor function. Its value is specified in degrees. Valid values are real numbers between 0 and 360.



The images (of size 100 x 100) on the left show Gabor filter kernels with values of the orientation parameter of 0, 45 and 90, from left to right, respectively. The values of the other parameters are as follows: wavelength 10, phase offset 0, aspect ratio 0.5, and bandwidth 1.

For one single convolution, enter one orientation value and set the value of the last parameter in the block "number of orientations" to 1. 
If "number of orientations" is set to an integer value N, N >= 1, then N convolutions will be computed. The orientations of the corresponding Gabor functions are equidistantly distributed between 0 and 360 degrees in increments of 360/N, starting from the value specified under "orientation(s)". An alternative way of computing multiple convolutions for different orientations is to specify under "orientation(s)" a list of values separated by commas (e.g. 0,45,110). In this case, the value of the parameter "number of orientations" is ignored. 


Phase offset(s) (φ)

The phase offset φ in the argument of the cosine factor of the Gabor function is specified in degrees. Valid values are real numbers between -180 and 180. The values 0 and 180 correspond to center-symmetric 'center-on' and 'center-off' functions, respectively, while -90 and 90 correspond to anti-symmetric functions. All other cases correspond to asymmetric functions.

T

he images (of size 100 x 100) on the left show Gabor filter kernels with values of the phase offset parameter of 0, 180, -90 and 90 dgerees, from left to right, respectively. The values of the other parameters are as follows: wavelength 10, orientation 0, aspect ratio 0.5, and bandwidth 1.

If one single value is specified, one convolution per orientation will be computed. If a list of values is given (e.g. 0,90 which is default), multiple convolutions per orientation will be computed, one for each value in the phase offset list. 


Aspect ratio (γ)

This parameter, called more precisely the spatial aspect ratio, specifies the ellipticity of the support of the Gabor function. For γ = 1, the support is circular. For γ < 1 the support is elongated in orientation of the parallel stripes of the function. Default value is γ = 0.5.



The images (of size 100 x 100) on the left show Gabor filter kernels with values of the aspect ratio parameter of 0.5 and 1, from left to right, respectively. The values of the other parameters are as follows: wavelength 10, orientation 0, phase offset 0, and bandwidth 1.


Bandwidth (b)

The half-response spatial frequency bandwidth b (in octaves) of a Gabor filter is related to the ratio σ / λ, where σ and λ are the standard deviation of the Gaussian factor of the Gabor function and the preferred wavelength, respectively, as follows:

equation 2.1

The value of σ cannot be specified directly. It can only be changed through the bandwidth b. The bandwidth value must be specified as a real positive number. Default is 1, in which case σ and λ are connected as follows: σ = 0.56 λ. The smaller the bandwidth, the larger σ, the support of the Gabor function and the number of visible parallel excitatory and inhibitory stripe zones.


The images (of size 100 x 100) on the left show Gabor filter kernels with values of the bandwidth parameter of 0.5, 1, and 2, from left to right, respectively. The values of the other parameters are as follows: wavelength 10, orientation 0, phase offset 0, and aspect ratio 0.5.


Number of orientations

Default value is 1. If an integer value N, N >= 1, is specified then N convolutions will computed. The orientations of the corresponding Gabor functions are equidistantly distributed between 0 and 360 degrees, with increments of 360/N, starting from the value specified in "orientation(s)". For this option to work, one single value (without a comma present) must be specified for the parameter "orientation(s)".

저작자 표시
신고
Trackback 0 | Comment 1
크리에이티브 커먼즈 라이선스
Creative Commons License

 Gabor filter
 


In image processing, a Gabor filter, named after Dennis Gabor, is a linear filter used for edge detection. Frequency and orientation representations of Gabor filter are similar to those of human visual system, and it has been found to be particularly appropriate for texture representation and discrimination. In the spatial domain, a 2D Gabor filter is a Gaussian kernel function modulated by a sinusoidal plane wave. The Gabor filters are self-similar – all filters can be generated from one mother wavelet by dilation and rotation.

Its impulse response is defined by a harmonic function multiplied by a Gaussian function. Because of the multiplication-convolution property (Convolution theorem), the Fourier transform of a Gabor filter's impulse response is the convolution of the Fourier transform of the harmonic function and the Fourier transform of the Gaussian function. The filter has a real and an imaginary component representing orthogonal directions[1]. The two components may be formed into a complex number or used individually.

Complex

g(x,y;\lambda,\theta,\psi,\sigma,\gamma) = \exp\left(-\frac{x'^2+\gamma^2y'^2}{2\sigma^2}\right)\exp\left(i\left(2\pi\frac{x'}{\lambda}+\psi\right)\right)

Real

g(x,y;\lambda,\theta,\psi,\sigma,\gamma) = \exp\left(-\frac{x'^2+\gamma^2y'^2}{2\sigma^2}\right)\cos\left(2\pi\frac{x'}{\lambda}+\psi\right)

Imaginary

g(x,y;\lambda,\theta,\psi,\sigma,\gamma) = \exp\left(-\frac{x'^2+\gamma^2y'^2}{2\sigma^2}\right)\sin\left(2\pi\frac{x'}{\lambda}+\psi\right)

where

x' = x \cos\theta + y \sin\theta\,

and

y' = -x \sin\theta + y \cos\theta\,

In this equation, λ represents the wavelength of the sinusoidal factor, θ represents the orientation of the normal to the parallel stripes of a Gabor function, ψ is the phase offset, σ is the sigma of the Gaussian envelope and γ is the spatial aspect ratio, and specifies the ellipticity of the support of the Gabor function.




Wavelet space

Gabor filters are directly related to Gabor wavelets, since they can be designed for a number of dilations and rotations. However, in general, expansion is not applied for Gabor wavelets, since this requires computation of bi-orthogonal wavelets, which may be very time-consuming. Therefore, usually, a filter bank consisting of Gabor filters with various scales and rotations is created. The filters are convolved with the signal, resulting in a so-called Gabor space. This process is closely related to processes in the primary visual cortex[2]. Jones and Palmer showed that the real part of the complex Gabor function is a good fit to the receptive field weight functions found in simple cells in a cat's striate cortex[3].

The Gabor space is very useful in image processing applications such as optical character recognition, iris recognition and fingerprint recognition. Relations between activations for a specific spatial location are very distinctive between objects in an image. Furthermore, important activations can be extracted from the Gabor space in order to create a sparse object representation.




Demonstration of a Gabor filter applied to Chinese OCR. Four orientations are shown on the right 0°, 45°, 90° and 135°. The original character picture and the superposition of all four orientations are shown on the left.


저작자 표시
신고
Trackback 0 | Comment 1
크리에이티브 커먼즈 라이선스
Creative Commons License

Gaussian filter

Shape of a typical Gaussian filter

In electronics and signal processing, a Gaussian filter is a filter whose impulse response is a Gaussian function. Gaussian filters are designed to give no overshoot to a step function input while minimizing the rise and fall time. This behavior is closely connected to the fact that the Gaussian filter has the minimum possible group delay. Mathematically, a Gaussian filter modifies the input signal by convolution with a Gaussian function; this transformation is also known as the Weierstrass transform.

 

Definition

The one-dimensional Gaussian filter has an impulse response given by

g(x)= \sqrt{\frac{a}{\pi}}\cdot e^{-a \cdot x^2}

or with the standard deviation as parameter

g(x) = \frac{1}{\sqrt{2\cdot\pi}\cdot\sigma}\cdot e^{-\frac{x^2}{2\sigma^2}}

In two dimensions, it is the product of two such Gaussians, one per direction:

g(x,y) = \frac{1}{2\pi \sigma^2} e^{-\frac{x^2 + y^2}{2 \sigma^2}} [1][2][3]

where x is the distance from the origin in the horizontal axis, y is the distance from the origin in the vertical axis, and σ is the standard deviation of the Gaussian distribution.


Digital implementation

The Gaussian function is non-zero for  x \in [-\infty,\infty] and would theoretically require an infinite window length. However, since it decays rapidly, it is often reasonable to truncate the filter window and implement the filter directly for narrow windows, in effect by using a simple rectangular window function. In other cases, the truncation may introduce significant errors. Better results can be achieved by instead using a different window function; see scale space implementation for details.

Filtering involves convolution. The filter function is said to be the kernel of an integral transform. The Gaussian kernel is continuous. Most commonly, the discrete equivalent is the sampled Gaussian kernel that is produced by sampling points from the continuous Gaussian. An alternate method is to use the discrete Gaussian kernel which has superior characteristics for some purposes. Unlike the sample Gaussian kernel, the discrete Gaussian kernel is the solution to the discrete diffusion equation.

Since the Fourier transform of the Gaussian function yields a Gaussian function, the signal (preferably after being divided into overlapping windowed blocks) can be transformed with a Fast Fourier transform, multiplied with a Gaussian function and transformed back. This is the standard procedure of applying an arbitrary finite impulse response filter, with the only difference that the Fourier transform of the filter window is explicitly known.

Due to the central limit theorem, the Gaussian can be approximated by several runs of a very simple filter such as the moving average. The simple moving average corresponds to convolution with the constant B-spline, and, for example, four iterations of a moving average yields a cubic B-spline as filter window which approximates the Gaussian quite well.

Borrowing the terms from statistics, the standard deviation of a filter can be interpreted as a measure of its size. The cut-off frequency of the filter can be considered as the ratio between the sample rate Fs and the standard deviation σ

f_c = \frac{F_s}{\sigma}

A simple moving average corresponds to a uniform probability distribution and thus its filter width of size n has standard deviation \sqrt{({\sigma}^2-1)/12}. Thus m moving averages with sizes {\sigma}_1,\dots,{\sigma}_m yield a standard deviation of

\sigma = \sqrt{\frac{{\sigma}_1^2+\cdots+{\sigma}_m^2-m}{12}}.

(Note that standard deviations do not sum up, but variances do.)

When applied in two dimensions, this formula produces a Gaussian surface that has a maximum at the origin, whose contours are concentric circles with the origin as center. A two dimensional convolution matrix is precomputed from the formula and convolved with two dimensional data. Each element in the resultant matrix new value is set to a weighted average of that elements neighborhood. The focal element receives the heaviest weight (having the highest Gaussian value) and neighboring elements receive smaller weights as their distance to the focal element increases. In Image processing, each element in the matrix represents a pixel attribute such as brightness or a color intensity, and the overall effect is called Gaussian blur.

The Gaussian filter is non-causal which means the filter window is symmetric about the origin. This is usually of no consequence for most applications. In real-time systems, a delay is incurred because incoming samples need to fill the filter window before the filter can be applied to the signal.



Order

1. gaussian sigma 구하기
  - Mask size를 통해서 sigma값을 구한다.
  - sigma = (maskSize - 1) * 6.0;

2. gaussian mask를 구한다.
  - (1/ (2.0 * pi * sigma * sigma) * exp( -1 * (x * x + y * y)/ (2.0 * sigma * sigma))

3. gaussian mask의 max값을 구한다.

4. gaussian mask(RGB) weight 값을 구한다.
  - weight = 255 / max;

저작자 표시
신고
Trackback 0 | Comment 1
크리에이티브 커먼즈 라이선스
Creative Commons License

Level set method 

 
An illustration of the level set method

A very simple, yet powerful way to understand the level set method is by first studying the accompanying illustration before proceeding towards a more technical definition, which then becomes quite accessible. The figure on the right illustrates several important ideas about the level set method. In the upper-left corner we see a shape; that is, a bounded region with a well-behaved boundary. Below it, the red surface is the graph of a level set function \varphi determining this shape, and the flat blue region represents the xy plane. The boundary of the shape is then the zero level set of \varphi, while the shape itself is the set of points in the plane for which \varphi is positive (interior of the shape) or zero (at the boundary).

In the top row we see the shape changing its topology by splitting in two. It would be quite hard to describe this transformation numerically by parameterizing the boundary of the shape and following its evolution. One would need an algorithm able to detect the moment the shape splits in two, and then construct parameterizations for the two newly obtained curves. On the other hand, if we look at the bottom row, we see that the level set function merely got translated downward. We see that it is much easier to work with a shape through its level set function than with the shape directly, where we would need to watch out for all the possible deformations the shape might undergo.

Thus, in two dimensions, the level set method amounts to representing a closed curve Γ (such as the shape in our example) using an auxiliary function  \varphi , called the level set function. Γ is represented as the zero level set of  \varphi by

\Gamma = \{(x, y)|\, \varphi(x, y) = 0 \}, \,

and the level set method manipulates Γ implicitly, through the function \varphi. \varphi is assumed to take positive values inside the region delimited by the curve Γ and negative values outside.[2][3]



The level set equation

If the curve Γ moves in the normal direction with a speed v, then the level set function \varphi satisfies the level set equation

\frac{\partial\varphi}{\partial t} = v|\nabla \varphi|.

Here, |\cdot| is the Euclidean norm (denoted customarily by single bars in PDEs), and t is time. This is a partial differential equation, in particular a Hamilton-Jacobi equation, and can be solved numerically, for example by using finite differences on a Cartesian grid.[2][3]

The numerical solution of the level set equation, however, requires sophisticated techniques. Simple finite difference methods fail quickly. Upwinding methods, such as the Godunov method, fare better; however the level set method does not guarantee the conservation of the volume and the shape of the level set in an advection field that does conserve the shape and size, for example uniform or rotational velocity field. Instead, the shape of the level set may get severely distorted and the level set may vanish over several time steps. For this reason, high-order finite difference schemes are generally required, such as high-order essentially non-oscillatory (ENO) schemes, and even then, the feasibility of long-time simulations is questionable. Further sophisticated methods to deal with this difficulty have been developed, e.g., combinations of the level set method with tracing marker particles advected by the velocity field.[4]







http://en.wikipedia.org/wiki/Level_set_method
저작자 표시
신고
Trackback 0 | Comment 0

강군v's Blog is powered by Daum & tistory

 

티스토리 툴바