tesseract  4.0.0-1-g2a2b
normfeat.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  ** Filename: normfeat.c
3  ** Purpose: Definition of char normalization features.
4  ** Author: Dan Johnson
5  ** History: 12/14/90, DSJ, Created.
6  **
7  ** (c) Copyright Hewlett-Packard Company, 1988.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  ******************************************************************************/
18 /*----------------------------------------------------------------------------
19  Include Files and Type Defines
20 ----------------------------------------------------------------------------*/
21 #include "normfeat.h"
22 
23 #include "intfx.h"
24 #include "featdefs.h"
25 #include "mfoutline.h"
26 
27 /*----------------------------------------------------------------------------
28  Public Code
29 ----------------------------------------------------------------------------*/
30 
32 float ActualOutlineLength(FEATURE Feature) {
33  return (Feature->Params[CharNormLength] * LENGTH_COMPRESSION);
34 }
35 
62  FEATURE_SET feature_set = NewFeatureSet(1);
63  FEATURE feature = NewFeature(&CharNormDesc);
64 
65  feature->Params[CharNormY] =
67  feature->Params[CharNormLength] =
69  feature->Params[CharNormRx] = MF_SCALE_FACTOR * fx_info.Rx;
70  feature->Params[CharNormRy] = MF_SCALE_FACTOR * fx_info.Ry;
71 
72  AddFeature(feature_set, feature);
73 
74  return feature_set;
75 } /* ExtractCharNormFeatures */
FEATURE_SET NewFeatureSet(int NumFeatures)
Definition: ocrfeatures.cpp:97
#define MF_SCALE_FACTOR
Definition: mfoutline.h:64
const int kBlnBaselineOffset
Definition: normalis.h:25
float Params[1]
Definition: ocrfeatures.h:62
float ActualOutlineLength(FEATURE Feature)
Definition: normfeat.cpp:32
#define LENGTH_COMPRESSION
Definition: normfeat.h:27
FEATURE NewFeature(const FEATURE_DESC_STRUCT *FeatureDesc)
Definition: ocrfeatures.cpp:81
int32_t Length
Definition: intfx.h:36
const FEATURE_DESC_STRUCT CharNormDesc
FEATURE_SET ExtractCharNormFeatures(const INT_FX_RESULT_STRUCT &fx_info)
Definition: normfeat.cpp:61
int16_t Ymean
Definition: intfx.h:37
bool AddFeature(FEATURE_SET FeatureSet, FEATURE Feature)
Definition: ocrfeatures.cpp:41