NAME
orientation - calculates axis of least second moment
SYNOPSIS
#include <math.h>
#include "ObjectContour.h"
double orientation(Image * labeledImage, int r, int c)
<labeledImage> - pointer to a labeled image
<r> - row coordinate of a point on a labeled image
<c> - column coordinate of a point on a labeled image
PATH
$CVIPHOME/FEATURE/binary_feature.c
DESCRIPTION
The function calculates the axis of least second moment of
an object of interest on a labeled image. The origin is the
center of area of that object and the angle is measured
from the r-axis counterclockwise. Equation of the axis is
given in chapter 2 of the soon-to-be-published book:
Computer Vision and Image Processing:
A practical Approach Using CVIPtools
S.E.Umbaugh, Prentice Hall, 1997
TYPES AND CONSTANTS
None
RETURN VALUES
A value of type double: axis of least second moment
represented by a radian angle
HISTORY
History information recorded: None
EXAMPLE
#include <math.h>
#include "ObjectContour.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("0nter the col coordinate of any pixel on the
labled image: ");
c = getInt_CVIP(10, 0, cols);
result = orientation(labeledImage, r, c);
print_CVIP("The orientation of the object (r, c) = %f",
result );
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.