Tesseract 3.01
|
00001 /****************************************************************************** 00002 ** Filename: featdefs.h 00003 ** Purpose: Definitions of currently defined feature types. 00004 ** Author: Dan Johnson 00005 ** History: Mon May 21 08:28:01 1990, DSJ, Created. 00006 ** 00007 ** (c) Copyright Hewlett-Packard Company, 1988. 00008 ** Licensed under the Apache License, Version 2.0 (the "License"); 00009 ** you may not use this file except in compliance with the License. 00010 ** You may obtain a copy of the License at 00011 ** http://www.apache.org/licenses/LICENSE-2.0 00012 ** Unless required by applicable law or agreed to in writing, software 00013 ** distributed under the License is distributed on an "AS IS" BASIS, 00014 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 ** See the License for the specific language governing permissions and 00016 ** limitations under the License. 00017 ******************************************************************************/ 00018 #ifndef FEATDEFS_H 00019 #define FEATDEFS_H 00020 00024 #include "ocrfeatures.h" 00025 00026 /* Enumerate the different types of features currently defined. */ 00027 #define NUM_FEATURE_TYPES 4 00028 00029 /* define error traps which can be triggered by this module.*/ 00030 #define ILLEGAL_SHORT_NAME 2000 00031 00032 /* A character is described by multiple sets of extracted features. Each 00033 set contains a number of features of a particular type, for example, a 00034 set of bays, or a set of closures, or a set of microfeatures. Each 00035 feature consists of a number of parameters. All features within a 00036 feature set contain the same number of parameters.*/ 00037 00038 struct CHAR_DESC_STRUCT { 00039 uinT32 NumFeatureSets; 00040 FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]; 00041 }; 00042 typedef CHAR_DESC_STRUCT *CHAR_DESC; 00043 00044 struct FEATURE_DEFS_STRUCT { 00045 uinT32 NumFeatureTypes; 00046 const FEATURE_DESC_STRUCT* FeatureDesc[NUM_FEATURE_TYPES]; 00047 const FEATURE_EXT_STRUCT* FeatureExtractors[NUM_FEATURE_TYPES]; 00048 int FeatureEnabled[NUM_FEATURE_TYPES]; 00049 }; 00050 typedef FEATURE_DEFS_STRUCT *FEATURE_DEFS; 00051 00052 /*---------------------------------------------------------------------- 00053 Generic functions for manipulating character descriptions 00054 ----------------------------------------------------------------------*/ 00055 void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs); 00056 00057 void FreeCharDescription(CHAR_DESC CharDesc); 00058 00059 CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs); 00060 00061 void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, 00062 FILE *File, CHAR_DESC CharDesc); 00063 00064 CHAR_DESC ReadCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, 00065 FILE *File); 00066 00067 int ShortNameToFeatureType(const FEATURE_DEFS_STRUCT &FeatureDefs, 00068 const char *ShortName); 00069 00073 extern const FEATURE_DESC_STRUCT MicroFeatureDesc; 00074 extern const FEATURE_DESC_STRUCT PicoFeatDesc; 00075 extern const FEATURE_DESC_STRUCT CharNormDesc; 00076 extern const FEATURE_DESC_STRUCT OutlineFeatDesc; 00077 #endif