NAME
pic_to_gabor - compute convolution of gabor masks with image
PROTOTYPE
unitptr pic_to_gabor( 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 source image
- int dy
- height in pixels of source image
- float *x
- array with x-coordinates of the n mask centers
- float *y
- array with y-coordinates of the n mask centers
- float *kx
- array of x-components of the n gabor wave vectors
- float *ky
- array of y-components of the n gabor wave vectors
- float *sig
- array of radii of the n 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[dx*dy]:
- (packed input field) pixel values of
image region to be convolved with array
of gabor masks.
- 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[n]:
- (output field 0) vector of convolution
values computed with image region.
DESCRIPTION:
Creates a unit with two input fields of dx*dy (packed) and
two pins, respectively, and one output field of n pins. Exe-
cution of the unit computes convolution 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 mask of the i-th gabor function 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 n convolution results are returned as
a field of dimension n. The intensity of
pixel (x,y) [x=0..dx-1, y=0..dy-1] is given by
pin x+y*dx.
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:
gabor_to_pic
FILE
/homes/jontrup/nst5/man/../o.sol2//../foldersrc/nst_filter.c