NAME

     texture - Texture Feature Extraction

SYNOPSIS

      #include "CVIPtoolkit.h"
      #include "CVIPdef.h"
      #include "CVIPimage.h"
      #include "string.h"
      #include "math.h"
      #include "CVIPsegment.h"
      #include "adaptThresh.h"
      #include "stdio.h"
      #include "string.h"
      #include "CVIPtexture.h"
      #include "CVIPtransform.h"

     TEXTURE * texture( const Image *ImgP, const Image *segP, int
     band, int r, int c, long int hex_equiv, int distance)

     Parameters:
      <ImgP> - pointer to source Image structure
      <segP> - pointer to labeled Image structure
      <band> - the band of the source image to be worked on
      <r> -  the row co-ordinate of the object
      <c> -  the column co-ordinate of the object
      <hex_equiv> - the hex equivalent of the Texture feature map
      <distance> -  the  pixel  distance  to  calculate  the  co-
     occurence matrix

PATH

     $CVIPHOME/FEATURE/CVIP_textureSetUp.c

DESCRIPTION

     Calculates  the  14  textural  features  based  on  the  co-
     occurrence  matrices  at 0, 45, 90, and 135 degrees. See the
     structure "TEXTURE" for the 14 features.  The input  parame-
     ter  <distance>  is  used  in  calculating  the co-occurence
     matrices.  The average and range of the four  directions  is
     also calculated and returned for each feature.

     The algorithms for calculating the 14 textural features  are
     taken  from  R.M.  Haralick,  K. Shanmugam, and I. Dinstein.
     1973. Textural  features  for  image  classification.  "IEEE
     Transactions on Systems, Man, and Cybertinetics, SMC-3 (6) :
     610-621.

     The input parameter <hex_equiv> is used to signal  which  of
     the    14    features    to    find.     See    the   struct
     "TEXTURE_FEATURE_MAP" for each features hex value.  To  cal-
     culate  more  than  one feature at a time simply add the hex
     values together. Features that are not selected to be calcu-
     lated  will  be  set  to zero. The function will only do one
     band of the image, the input parameter  <band>  is  used  to
     select which band to extract the features from.

     Gray level values of zero will be ignored, they will not  be
     used in the features calculations.

     The code for implementing  the  algrorithm  was  taken  from
     another  program  written  by  James Darrell McCauley, Texas
     Agricultural Experiment Station, Texas A&M  University   The
     algorithms were used as coded with some minor modifications.

TYPES AND CONSTANTS

     typedef struct  {
      /* [0] -> 0 degree, [1] -> 45 degree, [2] -> 90 degree, [3] -> 135 degree, [4] -> average, [5] -> range (max - min) */
      float ASM[6];          /*  (1) Angular Second Moment */
      float contrast[6];     /*  (2) Contrast */
      float correlation[6];  /*  (3) Correlation */
      float variance[6];     /*  (4) Variance */
      float IDM[6];          /*  (5) Inverse Diffenence Moment */
      float sum_avg[6];      /*  (6) Sum Average */
      float sum_var[6];      /*  (7) Sum Variance */
      float sum_entropy[6];  /*  (8) Sum Entropy */
      float entropy[6];      /*  (9) Entropy */
      float diff_var[6];     /* (10) Difference Variance */
      float diff_entropy[6]; /* (11) Diffenence Entropy */
      float meas_corr1[6];   /* (12) Measure of Correlation 1 */
      float meas_corr2[6];   /* (13) Measure of Correlation 2 */
      float max_corr_coef[6];/* (14) Maximal Correlation Coefficient */
      } TEXTURE;

     typedef struct {
      /* Allows the user to choose which features to extract, a zero will cause
        the feature to be ignored, the returned feature value will be 0.0 */
      int ASM;               /*  (1) Angular Second Moment (hex_equiv 0x0001) */
      int contrast;          /*  (2) Contrast (hex_equiv 0x0002) */
      int correlation;       /*  (3) Correlation (hex_equiv 0x0004) */
      int variance;          /*  (4) Variance (hex_equiv 0x0008) */
      int IDM;               /*  (5) Inverse Diffenence Moment (hex_equiv 0x0010) */
      int sum_avg;           /*  (6) Sum Average (hex_equiv 0x0020) */
      int sum_var;           /*  (7) Sum Variance (hex_equiv 0x0040) */
      int sum_entropy;       /*  (8) Sum Entropy (hex_equiv 0x0080) */
      int entropy;           /*  (9) Entropy (hex_equiv 0x0100) */
      int diff_var;          /* (10) Difference Variance (hex_equiv 0x0200) */
      int diff_entropy;      /* (11) Diffenence Entropy  (hex_equiv 0x0400) */
      int meas_corr1;        /* (12) Measure of Correlation 1 (hex_equiv 0x0800) */
      int meas_corr2;        /* (13) Measure of Correlation 2 (hex_equiv 0x1000) */
      int max_corr_coef;     /* (14) Maximal Correlation Coefficient (hex_equiv 0x2000) */
      } TEXTURE_FEATURE_MAP;

RETURN VALUES

     Pointer to a Texture Feature structure

HISTORY

     History information recorded: None

BUGS

     Runs slow with large objects (speed is also dependent on the
     number of different gray levels present in the image).

     The Maximal Correlation Coefficient  does  not  always  con-
     verge,  a NULL will be returned as its data.  Calculation of
     the Maximal Correlation Coefficient can take  a  long  time,
     especially if it does not converge

SEE ALSO

     libfeature, cvip_pgmtexture.c

AUTHOR

     Copyright (C) 1996 SIUE - by Scott E. Umbaugh and  Steven  M
     Costello.