MMACH (lmmach) functions


LIBRARY ROUTINE

lvsubm - Compute the difference (subtract) between two images pixel by pixel.

LIBRARY CALL

int
lvsubm(xvimage *img1, xvimage *img2, int img2_flg, int c, xvimage *img3, int mflg, xvimage *img4)

INPUT

OUTPUT

RETURN VALUE

TRUE (1) on success, FALSE (0) on failure

DESCRIPTION

lvsubm subtracts two images pixel by pixel with a operation gating mask. The second image can be chosen, optionally, as a constant.

img1 and img2 are input images, img3 is the gating image, and mflg should be set to one if the gating image is to be used. img4 is the output image. Note that img1 or img2 can be used for both the input and the resulting output xvimage structure, in order to save space.

A non-zero mask pixel in img3 enables the output pixel to contain the difference. A zero mask pixel in img3 just transfers the value of the corresponding pixel in img1 to the output pixel.

The mask image must be the same size as the input image. The output image data type is the same as the input data type.

lvsubm returns a value of one upon success and a zero on failure.

ADDITIONAL INFORMATION

none

EXAMPLES

none

SIDE EFFECTS

none

RESTRICTIONS

lvsubm can be defined for all data types supported by Khoros, but at the moment it has been implemented just for the bit and unsigned char types. The structuring elements are subsets of the 3x3 matrix and the origin is always at the center of this matrix.

Due to the simultaneous processing of 32 pixels in BIT images, input images of the BIT data type must be converted to a special data structure before the library is called. This can be accomplished by using the format routine. After the library call, the unformat routine can convert the image back to the BIT data type.

MODIFICATION

Luiz Fernando Vieira, Adriano Nagelschmidt Rodrigues: bug fixes and constant image option.

FILES

$MMACH/objects/library/lmmach/src/lvsubm.c

SEE ALSO

mmach(3)

COPYRIGHT

Copyright (C) 1993-1997 Junior Barrera, Roberto Lotufo. All rights reserved.