tesseract 3.04.01

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 &cn_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 cn_denorm 
)

Call the old micro-feature extractor and then copy the features into the new format. Then deallocate the old micro-features.

Parameters:
Blobblob to extract micro-features from
cn_denormcontrol parameter to feature extractor.
Returns:
Micro-features for Blob.
Note:
Exceptions: none
History: Wed May 23 18:06:38 1990, DSJ, Created.

Definition at line 45 of file mf.cpp.

                                                                {
  int NumFeatures;
  MICROFEATURES Features, OldFeatures;
  FEATURE_SET FeatureSet;
  FEATURE Feature;
  MICROFEATURE OldFeature;

  OldFeatures = BlobMicroFeatures(Blob, cn_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_HOST(!isnan(Feature->Params[i]));
    }
#endif

    AddFeature(FeatureSet, Feature);
  }
  FreeMicroFeatures(OldFeatures);
  return FeatureSet;
}                                /* ExtractMicros */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines