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 #ifndef FEATDEFS_H 19 #define FEATDEFS_H 20 21 /**---------------------------------------------------------------------------- 22 Include Files and Type Defines 23 ----------------------------------------------------------------------------**/ 24 #include "ocrfeatures.h" 25 26 /* Enumerate the different types of features currently defined. */ 27 #define NUM_FEATURE_TYPES 4 28 29 /* define error traps which can be triggered by this module.*/ 30 #define ILLEGAL_SHORT_NAME 2000 31 32 /* A character is described by multiple sets of extracted features. Each 33 set contains a number of features of a particular type, for example, a 34 set of bays, or a set of closures, or a set of microfeatures. Each 35 feature consists of a number of parameters. All features within a 36 feature set contain the same number of parameters.*/ 37 38 typedef struct 39 { 40 uinT32 NumFeatureSets; 41 FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]; 42 } CHAR_DESC_STRUCT; 43 typedef CHAR_DESC_STRUCT *CHAR_DESC; 44 45 typedef struct 46 { 47 uinT32 NumFeatureTypes; 48 FEATURE_DESC FeatureDesc[NUM_FEATURE_TYPES]; 49 FEATURE_EXT_STRUCT* FeatureExtractors[NUM_FEATURE_TYPES]; 50 int FeatureEnabled[NUM_FEATURE_TYPES]; 51 } FEATURE_DEFS_STRUCT; 52 typedef FEATURE_DEFS_STRUCT *FEATURE_DEFS; 53 54 /*---------------------------------------------------------------------- 55 Generic functions for manipulating character descriptions 56 ----------------------------------------------------------------------*/ 57 void FreeCharDescription(CHAR_DESC CharDesc); 58 59 CHAR_DESC NewCharDescription(); 60 61 void WriteCharDescription(FILE *File, CHAR_DESC CharDesc); 62 63 CHAR_DESC ReadCharDescription(FILE *File); 64 65 int ShortNameToFeatureType(const char *ShortName); 66 67 /**---------------------------------------------------------------------------- 68 Global Data Definitions and Declarations 69 ----------------------------------------------------------------------------**/ 70 extern FEATURE_DEFS_STRUCT FeatureDefs; 71 #endif 72