NAME
diff_segment -- create unit to segment image
PROTOTYPE
unitptr diff_segment( int iDx, int iDy, unitptr uHost)
ARGUMENTS
- int iDx
- width of image rectangle
- int iDy
- height of image rectangle
- unitptr uHost
- host unit
RETURN VALUE:
A pointer to the created unit or NULL in the case of an error.
INTERFACE OF CREATED UNIT:
- X_in[iDx*iDy]:
- (packed input field 0) Input image
- EPS_in[3]:
- adaptation rates for reference background (pins 0 and 1 for
masked and unmasked pixels), and
update threshold (pin 2, default = 0.8).
- CTL_in[5]:
- (control field) pos. and neg. deviation
thresholds (pins 0,1, default
is 10) for marking a pixel,
output value (pin 2, default is 0, i.e.
transmit input pixel intensity) and number of hole
filling iterations (pin 3, default=0) and min. number
of masked neighbors for hole filling (pin 4, default=5).
- X_out[iDx*iDy]:
- (packed output field 0) Output image. Zero at
all unmarked pixel locations, input intensity or
CTL_in[2] at the remaining marked locations.
EXECUTION OF CREATED UNIT:
This unit compares the current input image on a pixel by pixel basis
with an internally stored reference image. Those pixel locations of the input
image for which the intensity is by more than CTL_in[0] larger or
by more than CTL_in[1] smaller than the intensity at the corresponding
reference image location are marked (i.e., marked are all pixels
with intensity outside the closed interval [ref-CTL_in[1],ref+CTL_in[0]] ).
The output image
is zero at all unmarked pixel locations, while all marked locations have
the pixel value of the corresponding input pixel if CTL_in[2]=0 (the
default), or the constant value CTL_in[2] otherwise.
ADAPTATION OF CREATED UNIT:
During an adapt-call, the unit adapts its internal reference image
according to one of two modes:
a) if the fraction of marked pixels
from the previous exec - call exceeds the update threshold
( EPS_in[2] ),
the reference image is replaced by the current input image. This
feature can be used for an automatic recalibration after,
e.g., camere moves or very large image changes. The default value
for the update threshold is EPS_in[2]=0.8.
b) if a) does not apply, an adapt - call will make for
all pixels in the reference image the following gradual intensity change:
New[i] = (1-eps)*Old[i] + eps*X_in[i]
Here, the value eps=EPS_in[0] will be used for all pixels that
occupy unmarked pixel locations, and eps=EPS_in[1] for all pixels
that occupy marked pixel locations. This can be
used to automatically adapt to slow changes in lighting.
CONTROL MODES:
The following control modes are defined:
- NST_INIT:
- replace current reference image by input image.
SPECIAL FEATURES:
If CTL_in[3]>0, the output image will be constructed only after
the set of marked pixels has been CTL_in[3] times
iteratively enlarged according
to the following procedure: add to the set of marked pixels all
those unmarked pixels that have at least CTL_in[4] marked
nearest neighbors in their 8-neighborhood. The default setting
is CTL_in[3]=0 (i.e., no iterations) and CTL_in[4]=5.
This has the effect to close small `holes'' in the transmitted
pixel set. NOTE: in the current implementation, hole filling
is restricted to the subrectangle that is surrounded by a
1-pixel wide margin from the image border, and the iterations
are (for efficiency reasons) computed unbuffered, i.e.,
holes are filled while scanning the image line wise during
each iteration.
STATUS:
Preliminary.
DEFAULTS:
- EPS_in[0]=0
- adaptation rate for unmarked part of reference image
- EPS_in[1]=0
- adaptation rate for marked part of reference image
- EPS_in[2]=0.8
- threshold for full update of reference image by input image
- CTL_in[0]=10
- required pos. deviation from reference image for marking
- CTL_in[1]=10
- required neg. deviation from reference image for marking
- CTL_in[2]=0
- at marked locations: 0=transmit image intensity, the constant
value CTL_in[2] otherwise.
- CTL_in[3]=0
- number of `hole filling''-iterations
- CTL_in[4]=5
- min. number of marked neighbors for hole filling.
FILE
/homes/jontrup/nst5/man/../o.sol2//../foldersrc/nst_filter.c