NAME
get_histogram, get_histogram_Image - generates a histogram
array/Image from an image
SYNOPSIS
#include "histogram.h"
float **get_histogram(Image *imageP)
<imageP> - pointer to the input Image pointer
Image *get_histogram_Image(Image* imageP)
<imageP> - pointer to the input Image pointer
PATH
$CVIPHOME/HISTOGRAM/histogram.c
DESCRIPTION
get_histogram takes a pointer to an Image structure and gen-
erates a histogram from the input Image structure in the
form of a pointer to a pointer to a float. A separate his-
togram will be generated for each band in the image.
get_histogram_Image is similar to get_histogram, but it
returns an Image * of the input Image histogram, and is usu-
ally used for display purpose.
RETURN VALUES
On success, get_histogram returns float**, which is a 2-D
array containing a histogram for each band in the image;
get_histogram_Image returns a valid Image pointer. On
failure, both functions return a NULL pointer.
BUGS
May not work with some gif images.
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPconvert.h>
#include <CVIPview.h>
#include "histogram.h"
#define VIEWER "picture"
#define VIDEO_APP "SunVideo &"
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile,*outputfile;
float **histogram;
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 generates the histogram of
the image and returns a double float pointer */
histogram = get_histogram(cvipImage);
free(histogram);
/* the following call generates the histogram of
the image and returns the image pointer */
cvipImage = get_histogram_Image(cvipImage);
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
define_histogram, hist_spec, histogram_show, histogram_spec,
make_histogram, showMax_histogram
AUTHOR
Copyright (C) 1992, 1996 SIUE - by Scott E. Umbaugh and
David Lyons.