Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
matchdefs.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Filename: matchdefs.h
3 ** Purpose: Generic interface definitions for feature matchers.
4 ** Author: Dan Johnson
5 ** History: Fri Jan 19 09:21:25 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 MATCHDEFS_H
19 #define MATCHDEFS_H
20
24 #include "host.h"
25 #include <stdio.h>
26 #include "unichar.h"
27
28 /* define the maximum number of classes defined for any matcher
29 and the maximum class id for any matcher. This must be changed
30 if more different classes need to be classified */
31 #define MAX_NUM_CLASSES 12288
32 #define MAX_CLASS_ID (MAX_NUM_CLASSES - 1)
33
35 typedef UNICHAR_ID CLASS_ID;
36 #define NO_CLASS (0)
37
41 typedef inT16 PROTO_ID;
42 #define NO_PROTO (-1)
43
47 typedef uinT8 FEATURE_ID;
48 #define NO_FEATURE 255
49 #define NOISE_FEATURE 254
50 #define MISSING_PROTO 254
51 #define MAX_NUM_FEAT 40
52 #define MAX_FEATURE_ID 250
53
56 typedef FLOAT32 RATING;
57
62 typedef FLOAT32 CERTAINTY;
63
65 typedef struct
66 {
67 CLASS_ID Class;
68 RATING Rating;
69 CERTAINTY Certainty;
70 }
71
72
73 MATCH_RESULT;
74
76 typedef MATCH_RESULT SORTED_CLASSES[MAX_CLASS_ID + 1];
77
78 /*----------------------------------------------------------------------------
79 Public Function Prototypes
80 ----------------------------------------------------------------------------*/
89 /* misc test functions for proto id's and feature id's */
90 #define IsValidFeature(Fid) ((Fid) < MAX_FEATURE_ID)
91 #define IsValidProto(Pid) ((Pid) >= 0)
92
93 #if defined(__STDC__) || defined(__cplusplus)
94 # define _ARGS(s) s
95 #else
96 # define _ARGS(s) ()
97 #endif
98
99 /* matchdefs.c */
100 int CompareMatchResults
101 _ARGS ((MATCH_RESULT * Result1, MATCH_RESULT * Result2));
102
103 void PrintMatchResult _ARGS ((FILE * File, MATCH_RESULT * MatchResult));
104
105 void PrintMatchResults
106 _ARGS ((FILE * File, int N, MATCH_RESULT MatchResults[]));
107
108 #undef _ARGS
109
110 /*----------------------------------------------------------------------------
111 Global Data Definitions and Declarations
112 ----------------------------------------------------------------------------*/
113 #endif