xil_nearest_color(3)
NAME
xil_nearest_color − find nearest match of pixel values to entries in colormap
SYNOPSIS
#include <xil/xil.h>
void xil_nearest_color (XilImage src,
XilImage dst,
XilLookup cmap);
DESCRIPTION
This routine performs a pixel-by-pixel search for the nearest matching color in the supplied lookup table and sets the destination image pixel value to the appropriate colormap index. Nearest color is determined by calculating Euclidean distance for n-bands. src is the source image. dst is the destination image. cmap is a lookup table with the number of output bands equal to the number of bands in the source image.
ERRORS
For a complete list of XIL error messages by number, consult Appendix B of the XIL Programmer’s Guide.
EXAMPLES
Match nearest color for a 3-band image:
XilImage src;/∗ 3-band source image ∗/
XilImage dst;/∗ 1-band destination image ∗/
XilLookup colormap;/∗ colormap ∗/
xil_nearest_color(src, dst, colormap);
NOTES
The source image must have the same data type and the same number of bands as the lookup table. The destination image must have the same data type as the lookup table’s input data type.
A performance improvement is available for colorcube lookup tables. In this case, xil_ordered_dither(3) with a mask containing all values of 0.5 can be used to get essentially the same results as nearest color.
SEE ALSO
xil_colorcube_create(3), xil_lookup_create(3), xil_lookup_get_by_name(3), xil_ordered_dither(3).
SunOS 5.6 — Last change: 23 September 1996