Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
mf.cpp File Reference
`#include "mf.h"`
`#include "featdefs.h"`
`#include "mfdefs.h"`
`#include "mfx.h"`
`#include <math.h>`

Go to the source code of this file.

## Functions

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

## 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_HOST(!isnan(Feature->Params[i]));
}
#endif
AddFeature(FeatureSet, Feature);
}
FreeMicroFeatures(OldFeatures);
return FeatureSet;
} /* ExtractMicros */