classify/mf.cpp

Go to the documentation of this file.
00001 
00020 /* =================
00021  Include Files and Type Defines
00022  ==================== */
00023 #include "mfdefs.h"
00024 #include "variables.h"
00025 #include "mf.h"
00026 #include "fxdefs.h"
00027 #include "mfx.h"
00028 #include <math.h>
00029 
00030 /* =================
00031  Global Data Definitions and Declarations
00032  ==================== */
00033 /* =================
00034  Private Code
00035  ==================== */
00047 FEATURE_SET ExtractMicros(TBLOB *Blob, LINE_STATS *LineStats) { 
00048   int NumFeatures;
00049   MICROFEATURES Features, OldFeatures;
00050   FEATURE_SET FeatureSet;
00051   FEATURE Feature;
00052   MICROFEATURE OldFeature;
00053 
00054   OldFeatures = (MICROFEATURES) BlobMicroFeatures (Blob, LineStats);
00055   NumFeatures = count (OldFeatures);
00056   FeatureSet = NewFeatureSet (NumFeatures);
00057 
00058   Features = OldFeatures;
00059   iterate(Features) {
00060     OldFeature = (MICROFEATURE) first (Features);
00061     Feature = NewFeature (&MicroFeatureDesc);
00062     ParamOf (Feature, MFDirection) = OrientationOf (OldFeature);
00063     ParamOf (Feature, MFXPosition) = CenterX (OldFeature);
00064     ParamOf (Feature, MFYPosition) = CenterY (OldFeature);
00065     ParamOf (Feature, MFLength) = LengthOf (OldFeature);
00066 
00067     // Bulge features should not be used
00068     // anymore and are therefore set to 0.
00069 //     ParamOf (Feature, MFBulge1) = FirstBulgeOf (OldFeature);
00070 //     ParamOf (Feature, MFBulge2) = SecondBulgeOf (OldFeature);
00071     ParamOf (Feature, MFBulge1) = 0.0f;
00072     ParamOf (Feature, MFBulge2) = 0.0f;
00073 
00074     AddFeature(FeatureSet, Feature);
00075   }
00076   FreeMicroFeatures(OldFeatures);
00077   return (FeatureSet);
00078 
00079 }                                /* ExtractMicros */
00080 
00081 
00082 /* =============================== */
00096 void InitMicroFXVars() { 
00097   /*
00098      float_variable (ExtraPenaltyMagnitude, "MFExtraPenaltyMag",
00099      EXTRA_PENALTY_MAGNITUDE);
00100      float_variable (ExtraPenaltyWeight, "MFExtraPenaltyWeight",
00101      EXTRA_PENALTY_WEIGHT);
00102      float_variable (ExtraPenaltyOrder, "MFExtraPenaltyOrder",
00103      EXTRA_PENALTY_ORDER);
00104    */
00105   InitMicroFxVars();
00106 
00107 }                                /* InitMicroFXVars */

Generated on Wed Feb 28 19:49:10 2007 for Tesseract by  doxygen 1.5.1