mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-11 15:09:03 +08:00
023e1b340e
* api: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccmain: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccstruct: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * classify: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * cutil: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * dict: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * textord: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * training: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * wordrec: Replace Tesseract data types by POSIX data types Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccutil: Replace Tesseract data types by POSIX data types Now all Tesseract data types which are no longer needed can be removed from ccutil/host.h. Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX Remove the macros which are now unused from ccutil/host.h. Remove also the obsolete history comments. Signed-off-by: Stefan Weil <sw@weilnetz.de> * Fix build error caused by ambiguous ClipToRange Error message vom Appveyor CI: C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj] C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj] c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange' C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char' C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int' Signed-off-by: Stefan Weil <sw@weilnetz.de> * unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de> * arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX Signed-off-by: Stefan Weil <sw@weilnetz.de>
114 lines
4.0 KiB
C
114 lines
4.0 KiB
C
/******************************************************************************
|
|
** Filename: matchdefs.h
|
|
** Purpose: Generic interface definitions for feature matchers.
|
|
** Author: Dan Johnson
|
|
** History: Fri Jan 19 09:21:25 1990, DSJ, Created.
|
|
**
|
|
** (c) Copyright Hewlett-Packard Company, 1988.
|
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
|
** you may not use this file except in compliance with the License.
|
|
** You may obtain a copy of the License at
|
|
** http://www.apache.org/licenses/LICENSE-2.0
|
|
** Unless required by applicable law or agreed to in writing, software
|
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
** See the License for the specific language governing permissions and
|
|
** limitations under the License.
|
|
******************************************************************************/
|
|
#ifndef MATCHDEFS_H
|
|
#define MATCHDEFS_H
|
|
|
|
/**----------------------------------------------------------------------------
|
|
Include Files and Type Defines
|
|
----------------------------------------------------------------------------**/
|
|
#include "host.h"
|
|
#include <stdio.h>
|
|
#include "unichar.h"
|
|
|
|
/* define the maximum number of classes defined for any matcher
|
|
and the maximum class id for any matcher. This must be changed
|
|
if more different classes need to be classified */
|
|
#define MAX_NUM_CLASSES INT16_MAX
|
|
#define MAX_CLASS_ID (MAX_NUM_CLASSES - 1)
|
|
|
|
/** a CLASS_ID is the ascii character to be associated with a class */
|
|
typedef UNICHAR_ID CLASS_ID;
|
|
#define NO_CLASS (0)
|
|
|
|
/** a PROTO_ID is the index of a prototype within it's class. Valid proto
|
|
id's are 0 to N-1 where N is the number of prototypes that make up the
|
|
class. */
|
|
typedef int16_t PROTO_ID;
|
|
#define NO_PROTO (-1)
|
|
|
|
/** FEATURE_ID is the index of a feature within a character description
|
|
The feature id ranges from 0 to N-1 where N is the number
|
|
of features in a character description. */
|
|
typedef uint8_t FEATURE_ID;
|
|
#define NO_FEATURE 255
|
|
#define NOISE_FEATURE 254
|
|
#define MISSING_PROTO 254
|
|
#define MAX_NUM_FEAT 40
|
|
#define MAX_FEATURE_ID 250
|
|
|
|
/** a RATING is the match rating returned by a classifier.
|
|
Higher is better. */
|
|
typedef FLOAT32 RATING;
|
|
|
|
/** a CERTAINTY is an indication of the degree of confidence of the
|
|
classifier. Higher is better. 0 means the match is as good as the
|
|
mean of the matches seen in training. -1 means the match was one
|
|
standard deviation worse than the training matches, etc. */
|
|
typedef FLOAT32 CERTAINTY;
|
|
|
|
/** define a data structure to hold a single match result */
|
|
typedef struct
|
|
{
|
|
CLASS_ID Class;
|
|
RATING Rating;
|
|
CERTAINTY Certainty;
|
|
}
|
|
|
|
|
|
MATCH_RESULT;
|
|
|
|
/** define a data structure for holding an array of match results */
|
|
typedef MATCH_RESULT SORTED_CLASSES[MAX_CLASS_ID + 1];
|
|
|
|
/*----------------------------------------------------------------------------
|
|
Public Function Prototypes
|
|
----------------------------------------------------------------------------*/
|
|
/**
|
|
all feature matchers that are to be used with the high level
|
|
classifier must support the following interface. The names will, of
|
|
course, be unique for each different matcher. Note also that
|
|
FEATURE_STRUCT is a data structure that is defined specifically for
|
|
each feature extractor/matcher pair.
|
|
*/
|
|
|
|
/* misc test functions for proto id's and feature id's */
|
|
#define IsValidFeature(Fid) ((Fid) < MAX_FEATURE_ID)
|
|
#define IsValidProto(Pid) ((Pid) >= 0)
|
|
|
|
#if defined(__STDC__) || defined(__cplusplus)
|
|
# define _ARGS(s) s
|
|
#else
|
|
# define _ARGS(s) ()
|
|
#endif
|
|
|
|
/* matchdefs.c */
|
|
int CompareMatchResults
|
|
_ARGS ((MATCH_RESULT * Result1, MATCH_RESULT * Result2));
|
|
|
|
void PrintMatchResult _ARGS ((FILE * File, MATCH_RESULT * MatchResult));
|
|
|
|
void PrintMatchResults
|
|
_ARGS ((FILE * File, int N, MATCH_RESULT MatchResults[]));
|
|
|
|
#undef _ARGS
|
|
|
|
/*----------------------------------------------------------------------------
|
|
Global Data Definitions and Declarations
|
|
----------------------------------------------------------------------------*/
|
|
#endif
|