NAME
hist_feature - calculates histogram features: mean, standard
deviation, skew, energy and entropy
SYNOPSIS
#include <math.h>
#include "CVIPimage.h"
double *hist_feature(Image *originalImage, Image
*labeledImage, int r, int c)
<originalImage> - Pointer to the original image
<labeledImage> - Pointer to the labeled image
<r> - row coordinate of a point on the labled image
<c> - column coordinate of a point on the labled image
PATH
$CVIPHOME/FEATURE/hist_feature.c
DESCRIPTION
The program first calculates the histogram P(g) of the
object of interest in each band, then computes mean,
standard deviation, skew, energy and entropy.Those gray
level values whose P(g) equal to zero are filtered out.
Equations of these five measures are given in chapter 2
of following soon-to-be-published book:
Computer Vision and Image Processing:
A Practical Approach Using CVIPtools
S.E.Umbaugh, Prentice Hall, 1996
TYPES AND CONSTANTS
None
RETURN VALUES
A pointer to double, its value is equal to the initial
address of a one_dimensional array, which contains
above
five histogram features of each band. If the original
image
is a color image, the first five values are for band 0,
the
next five data are for band 1, and so on.
HISTORY
History information recorded: None
EXAMPLE
#include "CVIPtoolkit.h"
#include "CVIPobject.h"
#include "CVIPconvert.h"
#include <math.h>
#include "CVIPimage.h"
void main() {
Image *inputImage, *labeledImage;
IMAGE_FORMAT format;
char *inputfile;
int rows, cols, r, c;
double *result;
setDisplay_Image("picture", "Default");
print_CVIP("\nEnter the Input File Name: ");
inputfile = (char *) getString_CVIP();
inputImage = read_Image(inputfile, format, TRUE);
view_Image(inputImage,inputfile);
labeledImage = label(inputImage);
rows = getNoOfRows_Image(labeledImage);
cols = getNoOfCols_Image(labeledImage);
print_CVIP("\nEnter the row coordinate of a point on the
labled image: ");
r = getInt_CVIP(10, 0, rows);
print_CVIP("\nEnter the col coordinate of the point on
the labled image: ");
c = getInt_CVIP(10, 0, cols);
/* hist_feature - calculates histogram features: mean,
standard
deviation, skew, energy and entropy */
result = hist_feature(inputImage, labeledImage, r, c);
print_CVIP("Histogram feature:\n");
print_CVIP("\t mean = %d\n", *result);
print_CVIP("\t standard deviation = %d\n", *(result+1));
print_CVIP("\t skew = %d\n", *(result+1));
print_CVIP("\t energy = %d\n", *(result+1));
print_CVIP("\t entropy = %d\n", *(result+1));
free(inputfile);
}
DIAGNOSTICS
The original image can be of any of these data types:
CVIP_BYTE,
CVIP_SHORT, CVIP_INTEGER, CVIP_FLOAT and CVIP_DOUBLE.
SEE ALSO
libfeature
AUTHOR
Copyright (C) 1996 SIUE - by Scott E. Umbaugh and Wenxing
Li.