MCPcopy Create free account
hub / github.com/creatale/node-dv / ExtractMicros

Function ExtractMicros

deps/tesseract/classify/mf.cpp:45–83  ·  view source on GitHub ↗

---------------------------------------------------------------------------- Global Data Definitions and Declarations ----------------------------------------------------------------------------*/ ---------------------------------------------------------------------------- Private Code ----------------------------------------------------------------------------*/ * Call the o

Source from the content-addressed store, hash-verified

43 * @note History: Wed May 23 18:06:38 1990, DSJ, Created.
44 */
45FEATURE_SET ExtractMicros(TBLOB* Blob, const DENORM& cn_denorm) {
46 int NumFeatures;
47 MICROFEATURES Features, OldFeatures;
48 FEATURE_SET FeatureSet;
49 FEATURE Feature;
50 MICROFEATURE OldFeature;
51
52 OldFeatures = BlobMicroFeatures(Blob, cn_denorm);
53 if (OldFeatures == NULL)
54 return NULL;
55 NumFeatures = count (OldFeatures);
56 FeatureSet = NewFeatureSet (NumFeatures);
57
58 Features = OldFeatures;
59 iterate(Features) {
60 OldFeature = (MICROFEATURE) first_node (Features);
61 Feature = NewFeature (&MicroFeatureDesc);
62 Feature->Params[MFDirection] = OldFeature[ORIENTATION];
63 Feature->Params[MFXPosition] = OldFeature[XPOSITION];
64 Feature->Params[MFYPosition] = OldFeature[YPOSITION];
65 Feature->Params[MFLength] = OldFeature[MFLENGTH];
66
67 // Bulge features are deprecated and should not be used. Set to 0.
68 Feature->Params[MFBulge1] = 0.0f;
69 Feature->Params[MFBulge2] = 0.0f;
70
71#ifndef _WIN32
72 // Assert that feature parameters are well defined.
73 int i;
74 for (i = 0; i < Feature->Type->NumParams; i++) {
75 ASSERT_HOST(!isnan(Feature->Params[i]));
76 }
77#endif
78
79 AddFeature(FeatureSet, Feature);
80 }
81 FreeMicroFeatures(OldFeatures);
82 return FeatureSet;
83} /* ExtractMicros */

Callers 1

LearnBlobMethod · 0.85

Calls 4

BlobMicroFeaturesFunction · 0.85
countFunction · 0.85
NewFeatureSetFunction · 0.85
FreeMicroFeaturesFunction · 0.85

Tested by

no test coverage detected