tesseract  4.1.1
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 };
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
#define TESS_API
Definition: platform.h:54
TESS_API const char *const kMicroFeatureType
Definition: featdefs.cpp:32
TESS_API const FEATURE_DESC_STRUCT PicoFeatDesc
void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs)
Definition: featdefs.cpp:112
const FEATURE_DESC_STRUCT OutlineFeatDesc
void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc, STRING *str)
Definition: featdefs.cpp:174
CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs)
Definition: featdefs.cpp:148
TESS_API const char *const kCNFeatureType
Definition: featdefs.cpp:33
uint32_t ShortNameToFeatureType(const FEATURE_DEFS_STRUCT &FeatureDefs, const char *ShortName)
Definition: featdefs.cpp:270
const FEATURE_DESC_STRUCT MicroFeatureDesc
TESS_API const char *const kIntFeatureType
Definition: featdefs.cpp:34
const FEATURE_DESC_STRUCT IntFeatDesc
const FEATURE_DESC_STRUCT GeoFeatDesc
CHAR_DESC ReadCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, FILE *File)
Definition: featdefs.cpp:236
void FreeCharDescription(CHAR_DESC CharDesc)
Definition: featdefs.cpp:129
const FEATURE_DESC_STRUCT CharNormDesc
bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc)
Definition: featdefs.cpp:195
TESS_API const char *const kGeoFeatureType
Definition: featdefs.cpp:35
#define NUM_FEATURE_TYPES
Definition: featdefs.h:27
Definition: strngs.h:45
uint32_t NumFeatureSets
Definition: featdefs.h:40
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]
Definition: featdefs.h:41
int32_t NumFeatureTypes
Definition: featdefs.h:46
const FEATURE_DESC_STRUCT * FeatureDesc[NUM_FEATURE_TYPES]
Definition: featdefs.h:47