xil_subsample_binary_to_gray(3)
NAME
xil_subsample_binary_to_gray − subsample a binary image and produce a grayscale (byte) image
SYNOPSIS
#include <xil/xil.h>
void xil_subsample_binary_to_gray (XilImage src,
XilImage dst,
float xscale,
float yscale);
DESCRIPTION
This function subsamples a binary image and produces a grayscale (byte) image. src is the source image handle. dst is the destination image handle. xscale and yscale are the x and y scale factors, which must be less than or equal to 1.0 and greater than 0.0. The subsampling algorithm performs the scaling operation by accumulating all the bits in the source image that correspond to the destination pixel and, based on the x and y scaling factors, reserving consecutive indexes in the colormap for the maximum number of gray levels possible in the destination image. You must modify your colormap to define a gray level for each resulting index. For representing the source block of pixels that is used to determine destination pixel values, the index 0 represents a block with no 1’s (all 0’s), the index 1 represents a block with a single 1, and so on. If the scaling factors require a fractional block of source pixels to determine the destination pixel values, the block size is rounded up. For example, if a 2.2-by-2.2 block of source pixels would be required to determine destination pixel values, a 3-by-3 block is used, resulting in 10 possible gray levels and therefore 10 colormap indexes, whose values are 0 through 9.
ROI Behavior
If an ROI (region of interest) is attached to the source image, it is used as a read mask and is scaled into the destination image’s space, where it is intersected with the destination ROI (if there is one).
ERRORS
For a complete list of XIL error messages by number, consult Appendix B of the XIL Programmer’s Guide.
EXAMPLES
Subsample a binary image by .3 in the x direction and .4 in the y direction to produce a byte image:
XilImage src, dst;
xil_subsample_binary_to_gray(src, dst, .3, .4);
NOTES
This operation cannot be performed in place.
SEE ALSO
xil_subsample_adaptive(3), xil_scale(3).
SunOS 5.6 — Last change: 10 June 1994