tesseract  5.0.0-alpha-619-ge9db
intfx.h
Go to the documentation of this file.
1 /******************************************************************************
2  ** Filename: intfx.h
3  ** Purpose: Interface to high level integer feature extractor.
4  ** Author: Robert Moss
5  ** History: Tue May 21 15:51:57 MDT 1991, RWM, 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 #ifndef INTFX_H
19 #define INTFX_H
20 
24 #include "blobs.h"
25 #include "intproto.h"
26 #include "normalis.h"
27 #include <cmath>
28 
29 class DENORM;
30 
31 namespace tesseract {
32 class TrainingSample;
33 }
34 
36  int32_t Length; // total length of all outlines
37  int16_t Xmean, Ymean; // center of mass of all outlines
38  int16_t Rx, Ry; // radius of gyration
39  int16_t NumBL, NumCN; // number of features extracted
40  int16_t Width; // Width of blob in BLN coords.
41  uint8_t YBottom; // Bottom of blob in BLN coords.
42  uint8_t YTop; // Top of blob in BLN coords.
43 };
44 
45 // The standard feature length
46 const double kStandardFeatureLength = 64.0 / 5;
47 
51 void InitIntegerFX();
52 
53 // Returns a vector representing the direction of a feature with the given
54 // theta direction in an INT_FEATURE_STRUCT.
55 FCOORD FeatureDirection(uint8_t theta);
56 
57 namespace tesseract {
58  // Generates a TrainingSample from a TBLOB. Extracts features and sets
59  // the bounding box, so classifiers that operate on the image can work.
60  // TODO(rays) BlobToTrainingSample must remain a global function until
61  // the FlexFx and FeatureDescription code can be removed and LearnBlob
62  // made a member of Classify.
63  TrainingSample* BlobToTrainingSample(
64  const TBLOB& blob, bool nonlinear_norm, INT_FX_RESULT_STRUCT* fx_info,
66 }
67 
68 #endif
normalis.h
tesseract::BlobToTrainingSample
TrainingSample * BlobToTrainingSample(const TBLOB &blob, bool nonlinear_norm, INT_FX_RESULT_STRUCT *fx_info, GenericVector< INT_FEATURE_STRUCT > *bl_features)
Definition: intfx.cpp:75
INT_FX_RESULT_STRUCT::NumBL
int16_t NumBL
Definition: intfx.h:38
INT_FX_RESULT_STRUCT::YBottom
uint8_t YBottom
Definition: intfx.h:40
INT_FX_RESULT_STRUCT
Definition: intfx.h:34
INT_FX_RESULT_STRUCT::YTop
uint8_t YTop
Definition: intfx.h:41
kStandardFeatureLength
const double kStandardFeatureLength
Definition: intfx.h:45
FCOORD
Definition: points.h:187
blobs.h
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
InitIntegerFX
void InitIntegerFX()
Definition: intfx.cpp:48
INT_FX_RESULT_STRUCT::NumCN
int16_t NumCN
Definition: intfx.h:38
tesseract
Definition: baseapi.h:65
INT_FX_RESULT_STRUCT::Xmean
int16_t Xmean
Definition: intfx.h:36
GenericVector
Definition: baseapi.h:40
INT_FX_RESULT_STRUCT::Width
int16_t Width
Definition: intfx.h:39
TBLOB
Definition: blobs.h:282
INT_FX_RESULT_STRUCT::Length
int32_t Length
Definition: intfx.h:35
FeatureDirection
FCOORD FeatureDirection(uint8_t theta)
Definition: intfx.cpp:64
intproto.h
DENORM
Definition: normalis.h:49