Conversion of pixels to feature vectors
 

Objectives

The Matlab GUI 'ut_getgabor.m' is a graphical tool for the conversion of a selection of pixels of an input image into a set of corresponding feature vectors. The set of vectors, thus obtained, form the training data for the design of a pixel classifier using, for instance, prtools (see: http://www.prtools.org). Each feature vector contains the color information, and/or the texture information of its corresponding pixel. The texture feature extraction is based on radial log Gabor filtering.

Lay-out

The tool consists of four functional units for:

  • The opening of a new input image
  • The selection of the pixels in the image
  • The parameter selection and calculation of the texture filters
  • The output unit
 

The opening unit:

Here, a new image can be opened. The tool supports the following file formats: jpeg, tiff, gif and pong, in truecolor (RGB), indexed color, and gray levels. Images of type uint8 are converted to doubles, and normalized between 0 and 1 by dividing all pixels by 255. Index color images are converted to truecolor images. The 'view image' button opens a new figure window and displays the image.

The Gabor filtering unit:

Log radial Gabor filtering is applied to have the texture information. Gabor filteres are 2D Gaussian bandpass filters defined by a center frequency and a bandwidth. For 2D images, both the center frequency and the bandwidth must be defined in two directions. Radial Gabor filtering uses polar coordinates to align the Gaussian. See the contour plots above. The center frequencies and the principal axes of the filters are aligned  along the radial direction, and along the angular direction. Log radial Gabor uses a logarithmic scale for the radial frequency. That is, on a log frequency axis, i.e. log(r), the transfer function is a Gaussian:

The radial frequencies are normalized such that a frequency of 1 corresponds to half the sampling frequency. In the gui shown above, the highest peak frequency (is the centre frequency of the filter that passes the highest frequencies) is set to 0.8. The ratio of neighboring peak frequency is 0.5. Thus the sequence of center frequencies is 0.8, 0.4, 0.2, 0.1, 0.05, ... However, the number of filters in radial direction is 3. Therefore, these filters have centre frequencies of 0.8, 0.4 and 0.2, respectively. The relative bandwidth, s, is 0.65, expressed on a logarithmic scale. On a linear scale of r, this actually implements a deviation that is proportional to the center frequency.

The figure above specifies 6 filters in the angular direction implying that the difference of neighboring angles is 180/6=30 degrees. The relative bandwidth in angular direction is 0.667 meaning that the standard deviation of the filter transfer is 30*0.667=20 degrees.

For each filter the inphase and the quadruture component-images are calculated. The magnitude of these components is the final result. For each filter, the magnitude is stored as an image (with the same number of pixels as the input image). For color images, this procedure is applied to each color-band image, i.e. to R, G, and B. The multiple images that result from this procedure are stacked into one vector-valued image. In the example above, there are 3*6=18 filters. Thus, the output image (referred to as 'Gabor images') has 18 feature elements per pixel. In case of a color image this would be 3*18=54 elements.

With the button 'view Gabor image', the output of one of the filters (i.e. a Gabor image) is displayed in a new figure window. The amplitude of the images are scaled so as to match the range of the graphical display adaptor.

Note that if the input image shows a modulated harmonic function, then the Gabor filter that is tuned to that harmonic function produces the envelope of the input image, i.e. the modulation signal.

Selection of pixels:

There are three modes of pixel selection:

  • The full image (i.e. all pixels are selected).
  • A random selection
  • Selection of the pixels that are on a regular orthogonal grid. The variables 'deltaH' and 'deltaV' denote the pixel interval of the grid in horizontal and vertical direction.

The 'random selection' and 'selection on a grid' are added in order to provide a facility to tam the number of feature vectors. Without these modes, the training data can become unmanageably large.

A second facility for the selection is to use a ROI (region of interest). With the button 'define ROI' the user can define a polygonal ROI. If the corresponding radio button is on, then only pixels inside this ROI will be selected. This facility offers the possibility to create a labeled data set. The default ROI is the whole image area.

The output section:

The output section consists of three parts:

  • In the first part, the ROI can be saved in an image format  (jpeg, tiff, gif, or pong).
  • In the second part, one or all of the Gabor images can be written to file(s) in an image file format (jpeg, tiff, gif, or pong).
  • The third part can be used to write the created feature vectors of the selected pixels to a file using Matlab's 'save' command. The output file has the *.mat file format. Therefore, the data can be retrieved by using Matlab's 'load' command. The vectors are stored as row vectors in a matrix (with the same name as the filename of the mat-file). Thus, if 1000 pixels are selected, and the feature vector is formed by 18 Gabor images, then the size of the matrix is 1000*18. If the vectors are saved to the file 'foo.mat', then loading this file will create a matrix in the workspace, named 'foo'.

Version compatibility:

ut_getgabor is developed with Matlab 6.5sp1

Author:

Copyright (c): F. van der Heijden, all rights reserved, November 2004.