tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
featdefs.h
1 /******************************************************************************
2  ** Filename: featdefs.h
3  ** Purpose: Definitions of currently defined feature types.
4  ** Author: Dan Johnson
5  ** History: Mon May 21 08:28:01 1990, 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 #ifndef FEATDEFS_H
20 #define FEATDEFS_H
21 
25 #include "ocrfeatures.h"
26 
27 /* Enumerate the different types of features currently defined. */
28 #define NUM_FEATURE_TYPES 4
29 extern const char* kMicroFeatureType;
30 extern const char* kCNFeatureType;
31 extern const char* kIntFeatureType;
32 extern const char* kGeoFeatureType;
33 
34 /* A character is described by multiple sets of extracted features. Each
35  set contains a number of features of a particular type, for example, a
36  set of bays, or a set of closures, or a set of microfeatures. Each
37  feature consists of a number of parameters. All features within a
38  feature set contain the same number of parameters.*/
39 
41  uint32_t NumFeatureSets;
42  FEATURE_SET FeatureSets[NUM_FEATURE_TYPES];
43 };
44 using CHAR_DESC = CHAR_DESC_STRUCT *;
45 
47  int32_t NumFeatureTypes;
48  const FEATURE_DESC_STRUCT* FeatureDesc[NUM_FEATURE_TYPES];
49  int FeatureEnabled[NUM_FEATURE_TYPES];
50 };
52 
53 /*----------------------------------------------------------------------
54  Generic functions for manipulating character descriptions
55 ----------------------------------------------------------------------*/
56 void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs);
57 
58 void FreeCharDescription(CHAR_DESC CharDesc);
59 
60 CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs);
61 
62 bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs,
63  CHAR_DESC CharDesc);
64 
65 void WriteCharDescription(const FEATURE_DEFS_STRUCT& FeatureDefs,
66  CHAR_DESC CharDesc, STRING* str);
67 
68 CHAR_DESC ReadCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs,
69  FILE *File);
70 
71 uint32_t ShortNameToFeatureType(const FEATURE_DEFS_STRUCT &FeatureDefs,
72  const char *ShortName);
73 
77 extern const FEATURE_DESC_STRUCT MicroFeatureDesc;
78 extern TESS_API const FEATURE_DESC_STRUCT PicoFeatDesc;
79 extern const FEATURE_DESC_STRUCT CharNormDesc;
80 extern const FEATURE_DESC_STRUCT OutlineFeatDesc;
81 extern const FEATURE_DESC_STRUCT IntFeatDesc;
82 extern const FEATURE_DESC_STRUCT GeoFeatDesc;
83 #endif
Definition: ocrfeatures.h:53
Definition: featdefs.h:46
Definition: strngs.h:45
FEATURE_SET FeatureSets[4]
Definition: featdefs.h:42
int32_t NumFeatureTypes
Definition: featdefs.h:47
Definition: ocrfeatures.h:66
uint32_t NumFeatureSets
Definition: featdefs.h:41
Definition: featdefs.h:40