tesseract 4.1.1
Loading...
Searching...
No Matches
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 **
6 ** (c) Copyright Hewlett-Packard Company, 1988.
7 ** Licensed under the Apache License, Version 2.0 (the "License");
8 ** you may not use this file except in compliance with the License.
9 ** You may obtain a copy of the License at
10 ** http://www.apache.org/licenses/LICENSE-2.0
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 ******************************************************************************/
17
18#ifndef MATCHDEFS_H
19#define MATCHDEFS_H
20
24#include <cstdio>
25#include "unichar.h"
26
27/* define the maximum number of classes defined for any matcher
28 and the maximum class id for any matcher. This must be changed
29 if more different classes need to be classified */
30#define MAX_NUM_CLASSES INT16_MAX
31#define MAX_CLASS_ID (MAX_NUM_CLASSES - 1)
32
35#define NO_CLASS (0)
36
40using PROTO_ID = int16_t;
41#define NO_PROTO (-1)
42
46using FEATURE_ID = uint8_t;
47#define NO_FEATURE 255
48#define NOISE_FEATURE 254
49#define MISSING_PROTO 254
50#define MAX_NUM_FEAT 40
51#define MAX_FEATURE_ID 250
52
55using RATING = float;
56
61using CERTAINTY = float;
62
64typedef struct
65{
69}
70
71
73
76
77/*----------------------------------------------------------------------------
78 Public Function Prototypes
79----------------------------------------------------------------------------*/
88/* misc test functions for proto id's and feature id's */
89#define IsValidFeature(Fid) ((Fid) < MAX_FEATURE_ID)
90#define IsValidProto(Pid) ((Pid) >= 0)
91
92#if defined(__STDC__) || defined(__cplusplus)
93# define _ARGS(s) s
94#else
95# define _ARGS(s) ()
96#endif
97
98/* matchdefs.c */
99int CompareMatchResults
100_ARGS ((MATCH_RESULT * Result1, MATCH_RESULT * Result2));
101
102void PrintMatchResult _ARGS ((FILE * File, MATCH_RESULT * MatchResult));
103
104void PrintMatchResults
105_ARGS ((FILE * File, int N, MATCH_RESULT MatchResults[]));
106
107#undef _ARGS
108
109/*----------------------------------------------------------------------------
110 Global Data Definitions and Declarations
111----------------------------------------------------------------------------*/
112#endif
int UNICHAR_ID
Definition: unichar.h:34
UNICHAR_ID CLASS_ID
Definition: matchdefs.h:34
MATCH_RESULT SORTED_CLASSES[MAX_CLASS_ID+1]
Definition: matchdefs.h:75
float CERTAINTY
Definition: matchdefs.h:61
#define _ARGS(s)
Definition: matchdefs.h:95
int16_t PROTO_ID
Definition: matchdefs.h:40
float RATING
Definition: matchdefs.h:55
uint8_t FEATURE_ID
Definition: matchdefs.h:46
#define MAX_CLASS_ID
Definition: matchdefs.h:31
RATING Rating
Definition: matchdefs.h:67
CLASS_ID Class
Definition: matchdefs.h:66
CERTAINTY Certainty
Definition: matchdefs.h:68