lv1bgamut(3)

LIBRARY ROUTINE
lv1bgamut - Compress grey levels of an image, produce new image with map

LIBRARY CALL
#include "vinclude.h"
int
lv1bgamut(image,nlevels,fraction)
struct xvimage *image;
int nlevels;
float fraction;

INPUT

image
    pointer to xvimage structure to be processed

nlevels
    number of grey levels allowed in the output image

fraction
    allocation fraction, 0 means all levels chosen on the amount of area of the image that is in a particular colro range, 1 means all levels chosen to minimize the error in the grey span. About 0.5 is good.

OUTPUT

image
    holds the result of the operation. The output data type is the same as the input data type.

Return Value:
    1 on success, 0 on failure.

MODIFICATIONS
31-Oct-91 Scott Wilson - Added missing pointer initialization in load_color_list1; it was fixed in vgamut but not here.
2-Nov-91 Scott Wilson - Added output map sorting ala lvgamut()

DESCRIPTION
lv1bgamut takes a 1 band generates a 1 band image with a map of the specified number of color levels that can be displayed using editimage. The object is to make the displayable image look like the original even though the number of color levels is greatly restricted.

The method employed is that used for vgamut(1), but only for one band. All discussion pertinent to vgamut(1) is applicable here, except that the precision is fixed at 8 bits (i.e. full precision).

Note that image is used for both the input xvimage structure and the resulting output xvimage structure. This is done to save space, but you must be careful not to overwrite important data.

SEE ALSO
v1bgamut(1), intro(3), vipl(3), verror(3), vutils(3) lvgamut(1), lvmsquish(1)

RESTRICTIONS
lv1bgamut works only on BYTE image with 1 band of data and no map.

AUTHOR
Scott Wilson

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.