NAME
area - calculates area of an object of interest
SYNOPSIS
#include <math.h>
#include "ObjectContour.h"
long area(Image * labeledImage, int r, int c)
<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/binary_feature.c
DESCRIPTION
The program gets the sum of pixels whose gray level values
equal to a specific label. This label is the gray level
value of the point of coordinates <r,c> on the labeled
image.
TYPES AND CONSTANTS
None
RETURN VALUES
A value of type long int: area
HISTORY
History information recorded: None
EXAMPLE
#include "CVIPtoolkit.h"
#include "CVIPobject.h"
#include "CVIPconvert.h"
#include <math.h>
#include "ObjectContour.h"
void main() {
Image *inputImage, *labeledImage;
IMAGE_FORMAT format;
char *inputfile, *outputfile;
int rows, cols, r, c;
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);
print_CVIP("The area of the image which has the
same label = %d", area(labeledImage, r, c));
print_CVIP("\n");
free(inputfile);
}
DIAGNOSTICS
The labeled image can only of data type CVIP_INTEGER
SEE ALSO
libfeature
AUTHOR
Copyright (C) 1996 SIUE - by Scott E. Umbaugh and Wenxing
Li.