|
tesseract 3.04.01
|
Go to the source code of this file.
Functions | |
| FEATURE_SET | ExtractMicros (TBLOB *Blob, const DENORM &cn_denorm) |
| 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.
| Blob | blob to extract micro-features from |
| cn_denorm | control parameter to feature extractor. |
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 */