Tesseract
3.02
|
00001 /****************************************************************************** 00002 ** Filename: matchdefs.h 00003 ** Purpose: Generic interface definitions for feature matchers. 00004 ** Author: Dan Johnson 00005 ** History: Fri Jan 19 09:21:25 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 MATCHDEFS_H 00019 #define MATCHDEFS_H 00020 00024 #include "host.h" 00025 #include <stdio.h> 00026 #include "unichar.h" 00027 00028 /* define the maximum number of classes defined for any matcher 00029 and the maximum class id for any matcher. This must be changed 00030 if more different classes need to be classified */ 00031 #define MAX_NUM_CLASSES 12288 00032 #define MAX_CLASS_ID (MAX_NUM_CLASSES - 1) 00033 00035 typedef UNICHAR_ID CLASS_ID; 00036 #define NO_CLASS (0) 00037 00041 typedef inT16 PROTO_ID; 00042 #define NO_PROTO (-1) 00043 00047 typedef uinT8 FEATURE_ID; 00048 #define NO_FEATURE 255 00049 #define NOISE_FEATURE 254 00050 #define MISSING_PROTO 254 00051 #define MAX_NUM_FEAT 40 00052 #define MAX_FEATURE_ID 250 00053 00056 typedef FLOAT32 RATING; 00057 00062 typedef FLOAT32 CERTAINTY; 00063 00065 typedef struct 00066 { 00067 CLASS_ID Class; 00068 RATING Rating; 00069 CERTAINTY Certainty; 00070 } 00071 00072 00073 MATCH_RESULT; 00074 00076 typedef MATCH_RESULT SORTED_CLASSES[MAX_CLASS_ID + 1]; 00077 00078 /*---------------------------------------------------------------------------- 00079 Public Function Prototypes 00080 ----------------------------------------------------------------------------*/ 00089 /* misc test functions for proto id's and feature id's */ 00090 #define IsValidFeature(Fid) ((Fid) < MAX_FEATURE_ID) 00091 #define IsValidProto(Pid) ((Pid) >= 0) 00092 00093 #if defined(__STDC__) || defined(__cplusplus) 00094 # define _ARGS(s) s 00095 #else 00096 # define _ARGS(s) () 00097 #endif 00098 00099 /* matchdefs.c */ 00100 int CompareMatchResults 00101 _ARGS ((MATCH_RESULT * Result1, MATCH_RESULT * Result2)); 00102 00103 void PrintMatchResult _ARGS ((FILE * File, MATCH_RESULT * MatchResult)); 00104 00105 void PrintMatchResults 00106 _ARGS ((FILE * File, int N, MATCH_RESULT MatchResults[])); 00107 00108 #undef _ARGS 00109 00110 /*---------------------------------------------------------------------------- 00111 Global Data Definitions and Declarations 00112 ----------------------------------------------------------------------------*/ 00113 #endif