Tesseract  3.02
tesseract-ocr/classify/mf.h File Reference
#include "ocrfeatures.h"
#include "blobs.h"

Go to the source code of this file.

Typedefs

typedef float MicroFeature [MFCount]

Enumerations

enum  MF_PARAM_NAME {
  MFXPosition, MFYPosition, MFLength, MFDirection,
  MFBulge1, MFBulge2, MFCount
}

Functions

FEATURE_SET ExtractMicros (TBLOB *Blob, const DENORM &denorm)

Typedef Documentation

typedef float MicroFeature[MFCount]

Definition at line 33 of file mf.h.


Enumeration Type Documentation

---------------------------------------------------------------------------- Include Files and Type Defines ----------------------------------------------------------------------------

Enumerator:
MFXPosition 
MFYPosition 
MFLength 
MFDirection 
MFBulge1 
MFBulge2 
MFCount 

Definition at line 27 of file mf.h.


Function Documentation

FEATURE_SET ExtractMicros ( TBLOB Blob,
const DENORM denorm 
)

---------------------------------------------------------------------------- Include Files and Type Defines ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Global Data Definitions and Declarations ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Private Code ----------------------------------------------------------------------------

Definition at line 36 of file mf.cpp.

                                                             {
/*
 **     Parameters:
 **             Blob            blob to extract micro-features from
 **             denorm  control parameter to feature extractor.
 **     Globals: none
 **     Operation: Call the old micro-feature extractor and then copy
 **             the features into the new format.  Then deallocate the
 **             old micro-features.
 **     Return: Micro-features for Blob.
 **     Exceptions: none
 **     History: Wed May 23 18:06:38 1990, DSJ, Created.
 */
  int NumFeatures;
  MICROFEATURES Features, OldFeatures;
  FEATURE_SET FeatureSet;
  FEATURE Feature;
  MICROFEATURE OldFeature;

  OldFeatures = (MICROFEATURES)BlobMicroFeatures(Blob, denorm);
  if (OldFeatures == NULL)
    return NULL;
  NumFeatures = count (OldFeatures);
  FeatureSet = NewFeatureSet (NumFeatures);

  Features = OldFeatures;
  iterate(Features) {
    OldFeature = (MICROFEATURE) first_node (Features);
    Feature = NewFeature (&MicroFeatureDesc);
    Feature->Params[MFDirection] = OldFeature[ORIENTATION];
    Feature->Params[MFXPosition] = OldFeature[XPOSITION];
    Feature->Params[MFYPosition] = OldFeature[YPOSITION];
    Feature->Params[MFLength] = OldFeature[MFLENGTH];

    // Bulge features are deprecated and should not be used.  Set to 0.
    Feature->Params[MFBulge1] = 0.0f;
    Feature->Params[MFBulge2] = 0.0f;

#ifndef _WIN32
    // Assert that feature parameters are well defined.
    int i;
    for (i = 0; i < Feature->Type->NumParams; i++) {
      assert (!isnan(Feature->Params[i]));
    }
#endif

    AddFeature(FeatureSet, Feature);
  }
  FreeMicroFeatures(OldFeatures);
  return (FeatureSet);

}                                /* ExtractMicros */