## NAME

         irregular - calculates irregularity ratio

## SYNOPSIS

          #include <math.h>
          #include "ObjectContour.h"

         double irregular(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

         This function calculates the irregularity ratio of an object
         of interest on the labeled image. The formula used is:

                 irregularity ratio = (perimeter^2)/4*PI*area

         where area is area of the binary object,  and  perimeter  is
         the length of outer edge of the object.

## TYPES AND CONSTANTS

         None

## RETURN VALUES

         A value of type double: irregularity ratio

## HISTORY

         History information recorded: None
          #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 = irregular(labeledImage, r, c);
             print_CVIP("\nThe  irregularity ratio of the object
             = %f\n", result );

             free(inputfile);
           }

## SEE ALSO

         libfeature, area, perimeter

## AUTHOR

         Copyright (C) 1996 SIUE - by Scott E.  Umbaugh  and  Wenxing
         Li.