tesseract
4.0.0-1-g2a2b
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
19
#ifndef MATCHDEFS_H
20
#define MATCHDEFS_H
21
25
#include "
host.h
"
26
#include <cstdio>
27
#include "
unichar.h
"
28
29
/* define the maximum number of classes defined for any matcher
30
and the maximum class id for any matcher. This must be changed
31
if more different classes need to be classified */
32
#define MAX_NUM_CLASSES INT16_MAX
33
#define MAX_CLASS_ID (MAX_NUM_CLASSES - 1)
34
36
using
CLASS_ID
=
UNICHAR_ID
;
37
#define NO_CLASS (0)
38
42
using
PROTO_ID
= int16_t;
43
#define NO_PROTO (-1)
44
48
using
FEATURE_ID
= uint8_t;
49
#define NO_FEATURE 255
50
#define NOISE_FEATURE 254
51
#define MISSING_PROTO 254
52
#define MAX_NUM_FEAT 40
53
#define MAX_FEATURE_ID 250
54
57
using
RATING
= float;
58
63
using
CERTAINTY
= float;
64
66
typedef
struct
67
{
68
CLASS_ID
Class
;
69
RATING
Rating
;
70
CERTAINTY
Certainty
;
71
}
72
73
74
MATCH_RESULT
;
75
77
typedef
MATCH_RESULT
SORTED_CLASSES
[
MAX_CLASS_ID
+ 1];
78
79
/*----------------------------------------------------------------------------
80
Public Function Prototypes
81
----------------------------------------------------------------------------*/
90
/* misc test functions for proto id's and feature id's */
91
#define IsValidFeature(Fid) ((Fid) < MAX_FEATURE_ID)
92
#define IsValidProto(Pid) ((Pid) >= 0)
93
94
#if defined(__STDC__) || defined(__cplusplus)
95
# define _ARGS(s) s
96
#else
97
# define _ARGS(s) ()
98
#endif
99
100
/* matchdefs.c */
101
int
CompareMatchResults
102
_ARGS
((
MATCH_RESULT
* Result1,
MATCH_RESULT
* Result2));
103
104
void
PrintMatchResult
_ARGS
((FILE * File,
MATCH_RESULT
* MatchResult));
105
106
void
PrintMatchResults
107
_ARGS
((FILE * File,
int
N,
MATCH_RESULT
MatchResults[]));
108
109
#undef _ARGS
110
111
/*----------------------------------------------------------------------------
112
Global Data Definitions and Declarations
113
----------------------------------------------------------------------------*/
114
#endif
MAX_CLASS_ID
#define MAX_CLASS_ID
Definition:
matchdefs.h:33
RATING
float RATING
Definition:
matchdefs.h:57
UNICHAR_ID
int UNICHAR_ID
Definition:
unichar.h:35
CERTAINTY
float CERTAINTY
Definition:
matchdefs.h:63
FEATURE_ID
uint8_t FEATURE_ID
Definition:
matchdefs.h:48
host.h
_ARGS
#define _ARGS(s)
Definition:
matchdefs.h:97
CLASS_ID
UNICHAR_ID CLASS_ID
Definition:
matchdefs.h:36
MATCH_RESULT::Class
CLASS_ID Class
Definition:
matchdefs.h:68
unichar.h
MATCH_RESULT::Rating
RATING Rating
Definition:
matchdefs.h:69
MATCH_RESULT::Certainty
CERTAINTY Certainty
Definition:
matchdefs.h:70
PROTO_ID
int16_t PROTO_ID
Definition:
matchdefs.h:42
SORTED_CLASSES
MATCH_RESULT SORTED_CLASSES[MAX_CLASS_ID+1]
Definition:
matchdefs.h:77
MATCH_RESULT
Definition:
matchdefs.h:66
tesseract-ocr.master
src
dict
matchdefs.h
Generated on Mon Oct 29 2018 11:03:48 for tesseract by
1.8.14