xil_subtract(3)
NAME
xil_subtract, xil_subtract_const, xil_subtract_from_const − image subtraction operations
SYNOPSIS
#include <xil/xil.h>
void xil_subtract (XilImage src1,
XilImage src2,
XilImage dst);
void xil_subtract_const (XilImage src1,
float ∗constants,
XilImage dst);
void xil_subtract_from_const (float ∗constants,
XilImage src1,
XilImage dst);
DESCRIPTION
xil_subtract () performs a pixel-by-pixel subtraction of the src2 image from the src1 image and stores the result in the dst (destination) image. If the result of the operation is out of range for a particular data type, the result is clamped to the minimum or maximum value for the data type. Results for XIL_BYTE operations, for example, are clamped to 0 if they are less than 0 and 255 if they are greater than 255.
xil_subtract_const () performs a pixel-by-pixel subtraction of the constants values from the src1 image and stores the result in the dst (destination) image. For an n-band image, n float values must be provided, one per band. The value in constants[0] is subtracted from the values in band 0 of src and so on. If the result of the operation is out of range for a particular data type, the result is clamped to the minimum or maximum value for the data type. Results for XIL_BYTE operations, for example, are clamped to 0 if they are less than 0 and 255 if they are greater than 255.
xil_subtract_from_const () performs a pixel-by-pixel subtraction of the src1 image from the constants values and stores the result in the dst (destination) image. For an n-band image, n float values must be provided, one per band. The values in band 0 of src are subtracted from the value in constants[0] and so on. Resulting pixel values are rounded and clipped according to image data type.
ERRORS
For a complete list of XIL error messages by number, consult Appendix B of the XIL Programmer’s Guide.
EXAMPLES
Subtract image2 from image1 and store the result in dst :
XilImage image1, image2, dst;
xil_subtract(image1, image2, dst);
Subtract constants values from 4-band image1 and store the result in dst :
XilImage image1, dst;
float constants[4];
constants[0] = 1.0;
constants[1] = 1.0;
constants[2] = 1.0;
constants[3] = 0.0;
xil_subtract_const(image1, constants, dst);
Subtract 4-band image1 from constants values and store the result in dst :
XilImage image1, dst;
float constants[4];
constants[0] = 255.0;
constants[1] = 255.0;
constants[2] = 255.0;
constants[3] = 255.0;
xil_subtract_from_const(constants, image1, dst);
NOTES
Source and destination images must be the same data type and have the same number of bands. In-place operations are supported.
SEE ALSO
SunOS 5.6 — Last change: 03 August 1993