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 typedef struct 00039 { 00040 uinT32 NumFeatureSets; 00041 FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]; 00042 } CHAR_DESC_STRUCT; 00043 typedef CHAR_DESC_STRUCT *CHAR_DESC; 00044 00045 typedef struct 00046 { 00047 uinT32 NumFeatureTypes; 00048 FEATURE_DESC FeatureDesc[NUM_FEATURE_TYPES]; 00049 FEATURE_EXT_STRUCT* FeatureExtractors[NUM_FEATURE_TYPES]; 00050 int FeatureEnabled[NUM_FEATURE_TYPES]; 00051 } FEATURE_DEFS_STRUCT; 00052 typedef FEATURE_DEFS_STRUCT *FEATURE_DEFS; 00053 00054 /*---------------------------------------------------------------------- 00055 Generic functions for manipulating character descriptions 00056 ----------------------------------------------------------------------*/ 00057 void FreeCharDescription(CHAR_DESC CharDesc); 00058 00059 CHAR_DESC NewCharDescription(); 00060 00061 void WriteCharDescription(FILE *File, CHAR_DESC CharDesc); 00062 00063 CHAR_DESC ReadCharDescription(FILE *File); 00064 00065 int ShortNameToFeatureType(const char *ShortName); 00066 00070 extern FEATURE_DEFS_STRUCT FeatureDefs; 00071 #endif