NAME
aspect - calculates aspect ratio of an object of interest
SYNOPSIS
#include <math.h>
#include "ObjectContour.h"
double aspect(Image * labeledImage, int r, int c)
<labeledImage> - Pointer to the labeled image
< r > - row coordinate of the point on the labled image
< c > - column coordinate of the point on the labled image
PATH
$CVIPHOME/FEATURE/binary_feature.c
DESCRIPTION
The program calculates aspect ratio of the object of
interest on the labeled image Aspect ration is equal to
difference between maximum column value and minimum column
value of the object divided by difference between maximum
row value and mimum row value of the object.
TYPES AND CONSTANTS
None
RETURN VALUES
A value of type double: aspect ratio
HISTORY
History information recorded: None
EXAMPLE
#include <math.h>
#include "ObjectContour.h"
#include "CVIPfeatures.h"
#include "CVIPconvert.h"
void main() {
Image *inputImage, *labeledImage;
IMAGE_FORMAT format;
char *inputfile, *outputfile;
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, 1);
view_Image(inputImage,inputfile);
labeledImage = label(inputImage);
rows = getNoOfRows_Image(labeledImage);
cols = getNoOfCols_Image(labeledImage);
print_CVIP("\nEnter the row coordinate of any pixel
on the labled image: ");
r = getInt_CVIP(10, 0, rows);
print_CVIP("Enter the col coordinate of any pixel on
the labled image: ");
c = getInt_CVIP(10, 0, cols);
result = aspect(labeledImage, r, c);
print_CVIP("\nThe aspect ratio of the object =
%f\n", result );
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.