classify/mf.cpp File Reference

#include "mfdefs.h"
#include "variables.h"
#include "mf.h"
#include "fxdefs.h"
#include "mfx.h"
#include <math.h>

Go to the source code of this file.

Functions


Function Documentation

FEATURE_SET ExtractMicros ( TBLOB Blob,
LINE_STATS LineStats 
)

Call the old micro-feature extractor and then copy the features into the new format; deallocate the old micro-features.

Parameters:
Blob Blob to extract micro-features from
LineStats Statistics on text row blob is in
Returns:
Micro-features for Blob.
Note:
Exceptions: none
Date:
Wed May 23 18:06:38 1990, DSJ, Created.

Definition at line 47 of file mf.cpp.

References AddFeature(), BlobMicroFeatures(), CenterX, CenterY, count(), first, FreeMicroFeatures(), iterate, LengthOf, MFBulge1, MFBulge2, MFDirection, MFLength, MFXPosition, MFYPosition, MicroFeatureDesc, NewFeature(), NewFeatureSet(), OrientationOf, and ParamOf.

00047                                                               { 
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 */

void InitMicroFXVars (  ) 

Initialize the microfeature extractor variables that can be tuned without recompiling.

Parameters:
none 
Note:
Globals:
  • ExtraPenaltyMagnitude controls for adjusting extra penalty
  • ExtraPenaltyWeight
  • ExtraPenaltyOrder
Returns:
none
Note:
Exceptions: none
Date:
Thu May 24 10:50:46 1990, DSJ, Created.

Definition at line 96 of file mf.cpp.

References InitMicroFxVars().

00096                        { 
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:20 2007 for Tesseract by  doxygen 1.5.1