NAME

gabor_to_pic - map gabor masks to image region.

PROTOTYPE

unitptr gabor_to_pic( int n, int dx, int dy, float *x, float *y, float *kx, float *ky, float *sig, unitptr dest)

ARGUMENTS

int n
number of gabor masks used
int dx
width in pixels of destination image
int dy
height in pixels of destination image
float *x
array of x-coordinates of mask centers
float *y
array of y-coordinates of mask centers
float *kx
array of x-components of gabor wave vectors
float *ky
array of y-components of gabor wave vectors
float *sig
array of radii of gabor masks
unitptr dest
host unit for newly created instance

RETURN VALUE:

unitptr u
pointer to newly created unit

INTERFACE OF CREATED UNIT:

X_in[n]:
(input field 0) weight of gabor masks 0..n-1 in the superposition.
Y_in[2]:
(input field 1) offset (relative to lower left corner of image region) of origin with respect to which locations of mask centers are specified.
CTL_in[1]:
(input field 2) control field to set normalization (see Section NORMALIZATION below).
X_out[dx*dy]:
(packed output field 0) pixel values of image region representing weighted superposition of gabor masks.

DESCRIPTION:

Creates a unit with two input fields of n and two pins, respectively, and one packed output field of dx*dy pins. Execution of the unit computes superposition of n Gabor-functions centered at image locations (x[i]+xoffset,y[i]+yoffset), i=0,1,..n-1 and with wave vectors (kx[i],ky[i]) and gaussian widths sig[i]. The i -th gabor mask is defined as

   msk(x,y) = C exp(-(x*x+y*y)/(2*sig*sig)) f(x*Kx + y*Ky)

where x,y denote the offset in pixels from the center coordinate x[i]+xoffset,y[i]+yoffset of the mask, and the remaining parameters are given by sig=ABS(sig[i]), Kx=kx[i]*2pi/sig, Ky=ky[i]*2pi/sig and f=cos() for sig[i]=>0 and f=sin() for sig[i]<0. For the normalization constant C, see below. The superposition is returned as a packed field of dimension dx*dy. The intensity of pixel (x,y) [x=0..dx-1, y=0..dy-1] is given by pin x+y*dx. The coefficient for the i -th gabor function is specified by pin X_in[i], values for xoffset and yoffset may be specified through Y_in[0] (for xoffset, default = 0) and Y_in[1] (for yoffset, default = 0).

NORMALIZATION:

The normalization constant C depends on the value of F=CTL_in[0]. For F<0 (the default is F=1), it is given by C=-F/(2pi*sig*sig), i.e. each gaussian is normalized so that the integral over it equals -F. For F>0, it is given by C=F), i.e. in this case the gaussians are scaled so that their peak value is given by F. The default is F=1, i.e. normalization to peak value of unity.

NOTE:

Contrary to the usual convention, the n -dimensional arrays (call-by-reference parameters) x[],y[],sig[] are internally copied. They will be saved by routine save_unit (together with additional mask values) and the internally copied values can be restored by routine load_unit. Changes to x[],y[],kx[],ky[],sig[] AFTER the creation of the unit will be without any effect on the unit's operation.

DEFAULTS:

CTL_in[0]=1, xoffset=yoffset=0

SEE ALSO:

pic_to_gabor

FILE

/local/homes/rhaschke/nst7/man/../o.linx86//../foldersrc/nst_filter.c