mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
Merge branch 'master' of github.com-egorpugin:tesseract-ocr/tesseract
This commit is contained in:
commit
9eb52625cd
@ -27,14 +27,13 @@
|
||||
#include "helpers.h" // for chomp_string
|
||||
#include <tesseract/unichar.h> // for UNICHAR
|
||||
|
||||
#include <climits> // for INT_MAX
|
||||
#include <cstring> // for strchr, strcmp
|
||||
#include <fstream> // for std::ifstream
|
||||
#include <locale> // for std::locale::classic
|
||||
#include <sstream> // for std::stringstream
|
||||
#include <string> // for std::string
|
||||
|
||||
#include <limits.h> // for INT_MAX
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
// Special char code used to identify multi-blob labels.
|
||||
|
@ -51,11 +51,7 @@ class TESS_API ERRCODE { // error handler class
|
||||
|
||||
constexpr ERRCODE ASSERT_FAILED("Assert failed");
|
||||
|
||||
#if defined __cplusplus
|
||||
# define DO_NOTHING static_cast<void>(0)
|
||||
#else
|
||||
# define DO_NOTHING (void)(0)
|
||||
#endif
|
||||
#define DO_NOTHING static_cast<void>(0)
|
||||
|
||||
#define ASSERT_HOST(x) (x) \
|
||||
? DO_NOTHING \
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <tesseract/platform.h>
|
||||
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
|
||||
/* _WIN32 */
|
||||
@ -36,11 +37,6 @@
|
||||
#endif // _WIN32
|
||||
|
||||
#ifndef _WIN32
|
||||
# ifdef __cplusplus
|
||||
# include <climits>
|
||||
# else /* C compiler*/
|
||||
# include <limits.h>
|
||||
# endif /* __cplusplus */
|
||||
# ifndef PATH_MAX
|
||||
# define MAX_PATH 4096
|
||||
# else
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include "helpers.h" // for ReverseN
|
||||
|
||||
#include <climits> // for INT_MAX
|
||||
#include <cstdio>
|
||||
#include <limits.h> // for INT_MAX
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
|
@ -173,7 +173,7 @@ enum IntmatcherDebugAction {
|
||||
#define PPrunerMaskFor(I) (1 << PPrunerBitIndexFor(I))
|
||||
|
||||
#define MaxNumClassesIn(T) (T->NumClassPruners * CLASSES_PER_CP)
|
||||
#define LegalClassId(c) ((c) >= 0 && (c) <= MAX_CLASS_ID)
|
||||
#define LegalClassId(c) ((c) >= 0 && (c) < MAX_NUM_CLASSES)
|
||||
#define UnusedClassIdIn(T, c) ((T)->Class[c] == nullptr)
|
||||
#define ClassForClassId(T, c) ((T)->Class[c])
|
||||
#define ClassPrunersFor(T) ((T)->ClassPruner)
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
#include <tesseract/unichar.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <climits> // INT16_MAX
|
||||
#include <cstdint> // int16_t
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
@ -28,7 +29,6 @@ namespace tesseract {
|
||||
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 */
|
||||
using CLASS_ID = UNICHAR_ID;
|
||||
@ -44,67 +44,6 @@ using PROTO_ID = int16_t;
|
||||
The feature id ranges from 0 to N-1 where N is the number
|
||||
of features in a character description. */
|
||||
using FEATURE_ID = uint8_t;
|
||||
#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. */
|
||||
using RATING = float;
|
||||
|
||||
/** 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. */
|
||||
using CERTAINTY = float;
|
||||
|
||||
/** 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
|
||||
|
||||
} // namespace tesseract
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
# Makefile for Tesseract unit tests
|
||||
|
||||
# Be less noisy by default. Can be overridden with `make V=1`.
|
||||
V = 0
|
||||
|
||||
# Absolute path of directory 'langdata'.
|
||||
LANGDATA_DIR=$(shell cd $(top_srcdir) && cd .. && pwd)/langdata_lstm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user