tesseract
5.0.0-alpha-619-ge9db
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
61
FEATURE_SET
ExtractCharNormFeatures
(
const
INT_FX_RESULT_STRUCT
& fx_info) {
62
FEATURE_SET
feature_set =
NewFeatureSet
(1);
63
FEATURE
feature =
NewFeature
(&
CharNormDesc
);
64
65
feature->
Params
[
CharNormY
] =
66
MF_SCALE_FACTOR
* (fx_info.
Ymean
-
kBlnBaselineOffset
);
67
feature->
Params
[
CharNormLength
] =
68
MF_SCALE_FACTOR
* fx_info.
Length
/
LENGTH_COMPRESSION
;
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 */
AddFeature
bool AddFeature(FEATURE_SET FeatureSet, FEATURE Feature)
Definition:
ocrfeatures.cpp:39
intfx.h
INT_FX_RESULT_STRUCT
Definition:
intfx.h:34
mfoutline.h
FEATURE_STRUCT
Definition:
ocrfeatures.h:58
MF_SCALE_FACTOR
const float MF_SCALE_FACTOR
Definition:
mfoutline.h:70
INT_FX_RESULT_STRUCT::Ry
int16_t Ry
Definition:
intfx.h:37
INT_FX_RESULT_STRUCT::Ymean
int16_t Ymean
Definition:
intfx.h:36
INT_FX_RESULT_STRUCT::Rx
int16_t Rx
Definition:
intfx.h:37
CharNormLength
Definition:
normfeat.h:29
LENGTH_COMPRESSION
#define LENGTH_COMPRESSION
Definition:
normfeat.h:26
normfeat.h
FEATURE_STRUCT::Params
float Params[1]
Definition:
ocrfeatures.h:60
NewFeature
FEATURE NewFeature(const FEATURE_DESC_STRUCT *FeatureDesc)
Definition:
ocrfeatures.cpp:77
FEATURE_SET_STRUCT
Definition:
ocrfeatures.h:64
ExtractCharNormFeatures
FEATURE_SET ExtractCharNormFeatures(const INT_FX_RESULT_STRUCT &fx_info)
Definition:
normfeat.cpp:60
CharNormDesc
const FEATURE_DESC_STRUCT CharNormDesc
NewFeatureSet
FEATURE_SET NewFeatureSet(int NumFeatures)
Definition:
ocrfeatures.cpp:93
featdefs.h
INT_FX_RESULT_STRUCT::Length
int32_t Length
Definition:
intfx.h:35
ActualOutlineLength
float ActualOutlineLength(FEATURE Feature)
Definition:
normfeat.cpp:31
CharNormY
Definition:
normfeat.h:29
kBlnBaselineOffset
const int kBlnBaselineOffset
Definition:
normalis.h:24
CharNormRx
Definition:
normfeat.h:29
CharNormRy
Definition:
normfeat.h:29
src
classify
normfeat.cpp
Generated on Thu Jan 30 2020 14:22:20 for tesseract by
1.8.16