NAME
combine -- combine two image regions
PROTOTYPE
unitptr combine( int dx1, int dy1, int dx2, int dy2, int mode, unitptr dest)
ARGUMENTS
- int dx1
- width in pixels of image1
- int dy1
- height in pixels of image1
- int dx2
- width in pixels of image2
- int dy2
- height in pixels of image2
- int mode
- specifies operation (cf. below)
- unitptr dest
- host unit for newly created instance
RETURN VALUE:
- unitptr u:
- pointer to newly created unit
INTERFACE OF CREATED UNIT:
- X_in[dx1*dy1]:
- (packed input field 0) pixel values of
image1
- Y_in[dx2*dy2]:
- (packed input field 1) pixel values of
image2
- Z_in[2]:
- (input field 2) horizontal offset
xoffset and vertical offset yoffset
- X_out[dx1*dy1]:
- (packed output field 0) result image3
DESCRIPTION:
Creates unit execution of which combines rectangular subre-
gion of dx1*dy1 pixels of image1 with pixel rectangle of
size dx2*dy2 (image2). dx2=<dx1 and dy2=<dy1 must both hold.
Parameters xoffset, yoffset can be used to specify the lower
left corner of the affected subregion within image1. Note,
however, that image1 itself is not directly affected;
instead, the result image 3 is copied to the packed output
field X_out. The mode-parameter specifies in which way the
pixel values pix1 and pix2 of of the subregion of image 1
and image 2 are combined. The following values are allowed:
- mode= 0, invert
- pix3 = 255-pix1;
- mode= 1, substitute
- pix3 = pix2;
- mode= 2, add
- pix3 = pix1 + pix2;
- mode=-2, subtract
- pix3 = pix1 - pix2;
- mode= 3, multiply
- pix3 = pix1 * pix2;
- mode= 4, maximum
- pix3 = (pix1>pix2)?pix1:pix2;
- mode=-4, minimum
- pix3 = (pix1>pix2)?pix2:pix1;
- mode= 5, threshold1
- pix3 = (pix1>pix2)?pix1:0;
- mode=-5, threshold2
- pix3 = (pix1<pix2)?pix1:0;
- mode= 6, set white
- pix3 = 255;
- mode=-6, zeroing
- pix3 = 0;
Remark: In modes -6, 0, 6 the values of array pix2 are not used.
EXAMPLES:
The program -mouse.c provides an example of the use of the
combine -unit.
SEE ALSO:
convolve, sobel, laplace, remap
FILE
/amnt/loge/users/nistaff02/nistaff/rhaschke/nst7/man/../o.linux//../foldersrc/nst_pixel.c