NAME
gray_quant_segment - remaps to desired number of gray levels
SYNOPSIS
#include <CVIPimage.h>
#include <CVIPmatrix.h>
#include "CVIPsegment.h"
Image * gray_quant_segment(Image *cvipImage, int num_bits)
<cvipImage> - pointer to an Image structure
<num_bits> - number of gray levels desired (2,4,8,...128)
PATH
$CVIPHOME/SEGMENTATION/gray_quant.c
DESCRIPTION
This function remaps (quantizes) an image to a user-
specified number of gray levels. The number of gray levels
used must be a power of 2, to a maximum of 128 levels.
TYPES AND CONSTANTS
RETURN VALUES
A quantized image on success, and NULL pointer on failure
HISTORY
History information recorded: None
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPdef.h>
#include <CVIPconvert.h>
#include <CVIPview.h>
#define VIEWER "picture"
#define VIDEO_APP "SunVideo &"
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile,*outputfile;
setDisplay_Image(VIEWER, "Default");
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile,1);
view_Image(cvipImage, inputfile);
free(inputfile);
/* the following call remaps the desired number of
gray levels to 2 */
cvipImage = (Image *)gray_quant_segment(cvipImage,2);
print_CVIP("\n\t\tEnter the Output File Name: ");
outputfile = getString_CVIP();
view_Image(cvipImage,outputfile);
write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,
format,1);
free(outputfile);
}
SEE ALSO
libsegment
AUTHOR
Copyright (C) 1996 SIUE - by Scott E. Umbaugh and Kun Luo.