tesseract  5.0.0-alpha-619-ge9db
featdefs.h
Go to the documentation of this file.
1 /******************************************************************************
2  ** Filename: featdefs.h
3  ** Purpose: Definitions of currently defined feature types.
4  ** Author: Dan Johnson
5  **
6  ** (c) Copyright Hewlett-Packard Company, 1988.
7  ** Licensed under the Apache License, Version 2.0 (the "License");
8  ** you may not use this file except in compliance with the License.
9  ** You may obtain a copy of the License at
10  ** http://www.apache.org/licenses/LICENSE-2.0
11  ** Unless required by applicable law or agreed to in writing, software
12  ** distributed under the License is distributed on an "AS IS" BASIS,
13  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ** See the License for the specific language governing permissions and
15  ** limitations under the License.
16  ******************************************************************************/
17 
18 #ifndef FEATDEFS_H
19 #define FEATDEFS_H
20 
24 #include "ocrfeatures.h"
25 
26 /* Enumerate the different types of features currently defined. */
27 #define NUM_FEATURE_TYPES 4
28 extern TESS_API const char* const kMicroFeatureType;
29 extern TESS_API const char* const kCNFeatureType;
30 extern TESS_API const char* const kIntFeatureType;
31 extern TESS_API const char* const kGeoFeatureType;
32 
33 /* A character is described by multiple sets of extracted features. Each
34  set contains a number of features of a particular type, for example, a
35  set of bays, or a set of closures, or a set of microfeatures. Each
36  feature consists of a number of parameters. All features within a
37  feature set contain the same number of parameters.*/
38 
40  uint32_t NumFeatureSets;
42 };
43 using CHAR_DESC = CHAR_DESC_STRUCT *;
44 
46  int32_t NumFeatureTypes;
48 };
50 
51 /*----------------------------------------------------------------------
52  Generic functions for manipulating character descriptions
53 ----------------------------------------------------------------------*/
54 void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs);
55 
56 void FreeCharDescription(CHAR_DESC CharDesc);
57 
59 
60 bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs,
61  CHAR_DESC CharDesc);
62 
63 void WriteCharDescription(const FEATURE_DEFS_STRUCT& FeatureDefs,
64  CHAR_DESC CharDesc, STRING* str);
65 
67  FILE *File);
68 
69 uint32_t ShortNameToFeatureType(const FEATURE_DEFS_STRUCT &FeatureDefs,
70  const char *ShortName);
71 
79 extern const FEATURE_DESC_STRUCT IntFeatDesc;
80 extern const FEATURE_DESC_STRUCT GeoFeatDesc;
81 #endif
ReadCharDescription
CHAR_DESC ReadCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, FILE *File)
Definition: featdefs.cpp:235
ShortNameToFeatureType
uint32_t ShortNameToFeatureType(const FEATURE_DEFS_STRUCT &FeatureDefs, const char *ShortName)
Definition: featdefs.cpp:269
ValidCharDescription
bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc)
Definition: featdefs.cpp:194
CHAR_DESC_STRUCT::FeatureSets
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]
Definition: featdefs.h:40
GeoFeatDesc
const FEATURE_DESC_STRUCT GeoFeatDesc
STRING
Definition: strngs.h:45
kGeoFeatureType
const TESS_API char *const kGeoFeatureType
Definition: featdefs.cpp:34
NewCharDescription
CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs)
Definition: featdefs.cpp:147
OutlineFeatDesc
const FEATURE_DESC_STRUCT OutlineFeatDesc
FEATURE_DEFS_STRUCT::FeatureDesc
const FEATURE_DESC_STRUCT * FeatureDesc[NUM_FEATURE_TYPES]
Definition: featdefs.h:46
FEATURE_DEFS_STRUCT::NumFeatureTypes
int32_t NumFeatureTypes
Definition: featdefs.h:45
ocrfeatures.h
FEATURE_DESC_STRUCT
Definition: ocrfeatures.h:51
FEATURE_DEFS_STRUCT
Definition: featdefs.h:44
InitFeatureDefs
void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs)
Definition: featdefs.cpp:111
MicroFeatureDesc
const FEATURE_DESC_STRUCT MicroFeatureDesc
FEATURE_SET_STRUCT
Definition: ocrfeatures.h:64
CHAR_DESC_STRUCT
Definition: featdefs.h:38
kCNFeatureType
const TESS_API char *const kCNFeatureType
Definition: featdefs.cpp:32
NUM_FEATURE_TYPES
#define NUM_FEATURE_TYPES
Definition: featdefs.h:26
PicoFeatDesc
const TESS_API FEATURE_DESC_STRUCT PicoFeatDesc
CharNormDesc
const FEATURE_DESC_STRUCT CharNormDesc
FreeCharDescription
void FreeCharDescription(CHAR_DESC CharDesc)
Definition: featdefs.cpp:128
kIntFeatureType
const TESS_API char *const kIntFeatureType
Definition: featdefs.cpp:33
IntFeatDesc
const FEATURE_DESC_STRUCT IntFeatDesc
TESS_API
#define TESS_API
Definition: platform.h:54
CHAR_DESC_STRUCT::NumFeatureSets
uint32_t NumFeatureSets
Definition: featdefs.h:39
WriteCharDescription
void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc, STRING *str)
Definition: featdefs.cpp:173
kMicroFeatureType
const TESS_API char *const kMicroFeatureType
Definition: featdefs.cpp:31