00001
00020
00021
00022
00023 #include "normfeat.h"
00024 #include "mfoutline.h"
00025 #include "intfx.h"
00026
00027 #include "ocrfeatures.h"
00028 #include <stdio.h>
00029 #include "efio.h"
00030
00031
00032
00033
00034
00035
00036
00037
00038
00049 FLOAT32 ActualOutlineLength(FEATURE Feature) {
00050 return (ParamOf (Feature, CharNormLength) * LENGTH_COMPRESSION);
00051
00052 }
00053
00054
00055
00072 FEATURE_SET ExtractCharNormFeatures(TBLOB *Blob, LINE_STATS *LineStats) {
00073 FEATURE_SET FeatureSet;
00074 FEATURE Feature;
00075 FLOAT32 Scale;
00076 FLOAT32 Baseline;
00077 LIST Outlines;
00078 INT_FEATURE_ARRAY blfeatures;
00079 INT_FEATURE_ARRAY cnfeatures;
00080 INT_FX_RESULT_STRUCT FXInfo;
00081
00082
00083
00084 FeatureSet = NewFeatureSet (1);
00085 Feature = NewFeature (&CharNormDesc);
00086 AddFeature(FeatureSet, Feature);
00087
00088
00089 Outlines = ConvertBlob (Blob);
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106 ExtractIntFeat(Blob, blfeatures, cnfeatures, &FXInfo);
00107 Baseline = BaselineAt (LineStats, FXInfo.Xmean);
00108 Scale = ComputeScaleFactor (LineStats);
00109 ParamOf (Feature, CharNormY) = (FXInfo.Ymean - Baseline) * Scale;
00110 ParamOf (Feature, CharNormLength) =
00111 FXInfo.Length * Scale / LENGTH_COMPRESSION;
00112 ParamOf (Feature, CharNormRx) = FXInfo.Rx * Scale;
00113 ParamOf (Feature, CharNormRy) = FXInfo.Ry * Scale;
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 FreeOutlines(Outlines);
00131 return (FeatureSet);
00132 }