The GABOR_FILTER function applies a Gabor transform filter to a two-dimensional image. The Gabor filter consists of a sinusoidal wave in a particular orientation, with a Gaussian envelope that limits the effect to a localized region around each point in the image. The filter is useful for edge detection and texture analysis.
This routine is written in the IDL language. Its source code can be found in the file gabor_filter.pro in the lib subdirectory of the IDL distribution.
Example
To use the GABOR_FILTER, call the GABOR_KERNEL function first to construct the kernel and then pass the kernel to the routine. For example:
file = filepath('boulder.tif', subdir=['examples', 'data'])
image = (read_image(file))[300:799, 400:899]
kernel = gabor_kernel(lambda=7.5, sigma=3, theta=110*!dpi/180)
help, kernel
result = gabor_filter(image, kernel)
Now use the filter result to construct a new image where the largest values in the filtered result are colored red:
image = reform(image, 1, 500, 500)
imgtmp = image
result = abs(result)
h = total(histogram(result, nbins=100, locations=loc), /cumulative)
cutoff = min(where(h ge 0.9 * max(h)))
imgtmp[where(result ge loc[cutoff])] = 255
i = image([imgtmp, image, image])
Syntax
Result = GABOR_FILTER( ImageData, Kernel, /COMPLEX )
Return Value
Returns a double-precision array of the same dimensions as ImageData. If ImageData is complex then the complex Gabor transform is returned, otherwise the real Gabor transform is returned (unless /COMPLEX is set).
Arguments
ImageData
A two-dimensional array containing the values of the input image.
Kernel
A two-dimensional array containing the complex Gabor kernel.
Keywords
COMPLEX
Set this keyword to perform the complex Gabor transform and return a double complex result. The default is to return the complex transform for complex input and the real transform for all other data types.
Examples
You can explore different Gabor kernel values with various images using the gabor_demo_app routine, found in the examples/doc/image subdirectory of the IDL distribution. To run the routine, simply type gabor_demo_appon the IDL command line.
Version History
See Also
CONVOL, GABOR_KERNEL, Image Processing Routines