All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 &bl_denorm, const DENORM &cn_denorm, const INT_FX_RESULT_STRUCT &fx_info)
 

Function Documentation

FEATURE_SET ExtractMicros ( TBLOB Blob,
const DENORM bl_denorm,
const DENORM cn_denorm,
const INT_FX_RESULT_STRUCT fx_info 
)

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
bl_denormcurrently unused
cn_denormcontrol parameter to feature extractor.
fx_infocurrently unused
Returns
Micro-features for Blob.
Note
Exceptions: none
History: Wed May 23 18:06:38 1990, DSJ, Created.

Definition at line 47 of file mf.cpp.

49  {
50  int NumFeatures;
51  MICROFEATURES Features, OldFeatures;
52  FEATURE_SET FeatureSet;
53  FEATURE Feature;
54  MICROFEATURE OldFeature;
55 
56  OldFeatures = BlobMicroFeatures(Blob, cn_denorm);
57  if (OldFeatures == NULL)
58  return NULL;
59  NumFeatures = count (OldFeatures);
60  FeatureSet = NewFeatureSet (NumFeatures);
61 
62  Features = OldFeatures;
63  iterate(Features) {
64  OldFeature = (MICROFEATURE) first_node (Features);
65  Feature = NewFeature (&MicroFeatureDesc);
66  Feature->Params[MFDirection] = OldFeature[ORIENTATION];
67  Feature->Params[MFXPosition] = OldFeature[XPOSITION];
68  Feature->Params[MFYPosition] = OldFeature[YPOSITION];
69  Feature->Params[MFLength] = OldFeature[MFLENGTH];
70 
71  // Bulge features are deprecated and should not be used. Set to 0.
72  Feature->Params[MFBulge1] = 0.0f;
73  Feature->Params[MFBulge2] = 0.0f;
74 
75 #ifndef _WIN32
76  // Assert that feature parameters are well defined.
77  int i;
78  for (i = 0; i < Feature->Type->NumParams; i++) {
79  ASSERT_HOST(!isnan(Feature->Params[i]));
80  }
81 #endif
82 
83  AddFeature(FeatureSet, Feature);
84  }
85  FreeMicroFeatures(OldFeatures);
86  return FeatureSet;
87 } /* ExtractMicros */
#define isnan(x)
Definition: mathfix.h:31
#define XPOSITION
Definition: mfdefs.h:36
FEATURE NewFeature(const FEATURE_DESC_STRUCT *FeatureDesc)
Definition: ocrfeatures.cpp:96
FEATURE_SET NewFeatureSet(int NumFeatures)
#define YPOSITION
Definition: mfdefs.h:37
Definition: mf.h:29
Definition: mf.h:29
FLOAT32 * MICROFEATURE
Definition: mfdefs.h:33
const FEATURE_DESC_STRUCT * Type
Definition: ocrfeatures.h:64
void FreeMicroFeatures(MICROFEATURES MicroFeatures)
Definition: mfdefs.cpp:48
#define ASSERT_HOST(x)
Definition: errcode.h:84
Definition: mf.h:29
Definition: mf.h:28
#define first_node(l)
Definition: oldlist.h:139
#define iterate(l)
Definition: oldlist.h:159
MICROFEATURES BlobMicroFeatures(TBLOB *Blob, const DENORM &cn_denorm)
Definition: mfx.cpp:72
FLOAT32 Params[1]
Definition: ocrfeatures.h:65
Definition: mf.h:28
int count(LIST var_list)
Definition: oldlist.cpp:108
BOOL8 AddFeature(FEATURE_SET FeatureSet, FEATURE Feature)
Definition: ocrfeatures.cpp:44
Definition: mf.h:29
#define ORIENTATION
Definition: mfdefs.h:39
#define NULL
Definition: host.h:144
const FEATURE_DESC_STRUCT MicroFeatureDesc
#define MFLENGTH
Definition: mfdefs.h:38