classify/float2int.h File Reference

#include "intmatcher.h"
#include "ocrfeatures.h"

Go to the source code of this file.

Defines

Functions


Define Documentation

#define BASELINE_Y_SHIFT   (0.25)

FIX:

Definition at line 32 of file float2int.h.

Referenced by ComputeIntFeatures().

#define INT_FEAT_RANGE   256

FIX:

Definition at line 30 of file float2int.h.

Referenced by ComputeIntFeatures().


Function Documentation

void ClearCharNormArray ( INT_TEMPLATES  Templates,
CLASS_NORMALIZATION_ARRAY  CharNormArray 
)

For each class in Templates, clear the corresponding entry in CharNormArray.

Parameters:
Templates Specifies classes currently defined
CharNormArray Array to be cleared
Returns:
none
CharNormArray is indexed by class indicies (as obtained from Templates) rather than class id's.
Note:
Exceptions: none
Date:
Wed Feb 20 11:20:54 1991, DSJ, Created.

Definition at line 45 of file float2int.cpp.

References NumClassesIn.

Referenced by GetBaselineFeatures(), and GetIntBaselineFeatures().

00046                                                                  {
00047   int i;
00048 
00049   for (i = 0; i < NumClassesIn (Templates); i++) {
00050     CharNormArray[i] = 0;
00051   }
00052 
00053 }                                /* ClearCharNormArray */

void ComputeIntCharNormArray ( FEATURE  NormFeature,
INT_TEMPLATES  Templates,
CLASS_NORMALIZATION_ARRAY  CharNormArray 
)

For each class in Templates, compute the match between NormFeature and the normalization protos for that class.

Parameters:
NormFeature Character normalization feature
Templates Specifies classes currently defined
CharNormArray Place to put results
Returns:
none (results are returned in CharNormArray)
Convert this number to the range from 0 - 255 and store it into CharNormArray. CharNormArray is indexed by class indicies (as obtained from Templates) rather than class id's.
Note:
Exceptions: none
Date:
Wed Feb 20 11:20:54 1991, DSJ, Created.

Definition at line 71 of file float2int.cpp.

References ClassIdForIndex, ComputeNormMatch(), FALSE, INT_CHAR_NORM_RANGE, MAX_INT_CHAR_NORM, and NumClassesIn.

Referenced by GetIntCharNormFeatures().

00073                                                                       {
00074   int i;
00075   int NormAdjust;
00076 
00077   for (i = 0; i < NumClassesIn (Templates); i++) {
00078     NormAdjust = (int) (INT_CHAR_NORM_RANGE *
00079       ComputeNormMatch (ClassIdForIndex (Templates, i),
00080       NormFeature, FALSE));
00081     if (NormAdjust < 0)
00082       NormAdjust = 0;
00083     else if (NormAdjust > MAX_INT_CHAR_NORM)
00084       NormAdjust = MAX_INT_CHAR_NORM;
00085 
00086     CharNormArray[i] = NormAdjust;
00087   }
00088 
00089 }                                /* ComputeIntCharNormArray */

void ComputeIntFeatures ( FEATURE_SET  Features,
INT_FEATURE_ARRAY  IntFeatures 
)

Definition at line 102 of file float2int.cpp.

References ANGLE_SHIFT, baseline, BASELINE_Y_SHIFT, BucketFor(), CircBucketFor(), FeatureIn, INT_FEAT_RANGE, NormMethod, NumFeaturesIn, ParamOf, PicoFeatDir, PicoFeatX, PicoFeatY, X_SHIFT, and Y_SHIFT.

Referenced by GetAdaptiveFeatures(), and GetBaselineFeatures().

00102                                                                              { 
00103   int Fid;
00104   FEATURE Feature;
00105   FLOAT32 YShift;
00106 
00107   if (NormMethod == baseline)
00108     YShift = BASELINE_Y_SHIFT;
00109   else
00110     YShift = Y_SHIFT;
00111 
00112   for (Fid = 0; Fid < NumFeaturesIn (Features); Fid++) {
00113     Feature = FeatureIn (Features, Fid);
00114 
00115     IntFeatures[Fid].X = BucketFor (ParamOf (Feature, PicoFeatX),
00116       X_SHIFT, INT_FEAT_RANGE);
00117     IntFeatures[Fid].Y = BucketFor (ParamOf (Feature, PicoFeatY),
00118       YShift, INT_FEAT_RANGE);
00119     IntFeatures[Fid].Theta = CircBucketFor (ParamOf (Feature, PicoFeatDir),
00120       ANGLE_SHIFT, INT_FEAT_RANGE);
00121     IntFeatures[Fid].CP_misses = 0;
00122   }
00123 }                                /* ComputeIntFeatures */


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