gabor: Two Dimensional Gabor Filtering in Frequency Domain

Description Usage Arguments Value References Examples

Description

The function provides two dimensional Gabor function proposed by Daugman to model the spatial summation properties in the visual cortex. It returns Gabor filter in real and reciprocal space, and filtered image.

Usage

1
gabor.filter(x, lamda=5, theta=45, bw=1.5, phi=0, asp=1, disp=FALSE)

Arguments

x

A raster or matrix to be filtered

lamda

Wavelength of the cosine part of Gabor filter kernel in pixel. Real number greater than 2 can be used. However, lamda=2 should not be used with phase offset (phi) = -90 or 90.

theta

The orientation of parallel stips of Gabor function in degree

bw

Half responce spatial frequency bandwidth of a Gabor filter. This relates to the ratio sigma/lamda, where sigma is the standard deviation of Gaussian factor of Gabor function.

phi

Phase offset of the cosine part of Gabor filter kernel in degree

asp

Elliptcity of the Gabor function. asp=1 means circular. For asp<1 it gives elongated parallel strip

disp

If this operator is TRUE, original image, gabor filter in real space domain, that in frequency domain, and filtered image will be generated

Value

The function provides following four outputs.

kernel

151x151 gabor filter kernel

mask

A mask with kernel in the center in a space domain

freq_mask

Real part of Fourier transform of the mask in spatial frequency domain

filtered_image

Inversed Fourier transform of FFT(img)*FFT(mask)

References

J. G. Daugman, Uncertainty relation for resolution in space, spatial frequency, and orientation optimized by two d-dimensional visual cortical filters, J. Opt. Sppc. Am A, 2(7), 1160-1169, 1985

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(cryptomeria)
img <- rgb2gray(cryptomeria)
img <- crop(img,300,300)
# simple example
test <- gabor.filter(x=img, lamda=8, theta=60, bw=1.5, phi=0, asp=0.3, disp=TRUE)
## Not run: 
# azimuthal intensity distribution with respect to the orientation of Gabor function
par(mfrow=c(2,1))
Integ <- array()
filt.img <- matrix(0, nrow(img), ncol(img))
for ( i in 1:60) {
out <- gabor.filter(x=img, lamda=8, theta=3*i, bw=1.5, phi=0, asp=0.3)
filt.img <- out$filtered_img + filt.img
Integ[i] <- sum(out$filtered_img*out$filtered_img)
}
image(rot90c(filt.img),col=gray(c(0:255)/255),asp=1,axes=FALSE, useRaster=TRUE)
x <- 1:60
plot(3*x,Integ, ty="l", ylab="integrated intensity (a.u.)", xlab="azimuthal angle (deg)")

## End(Not run)

wvtool documentation built on May 29, 2017, 1:53 p.m.