2007-03-08 04:03:40 +08:00
|
|
|
/******************************************************************************
|
|
|
|
** Filename: featdefs.h
|
|
|
|
** Purpose: Definitions of currently defined feature types.
|
|
|
|
** Author: Dan Johnson
|
|
|
|
** History: Mon May 21 08:28:01 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 FEATDEFS_H
|
|
|
|
#define FEATDEFS_H
|
|
|
|
|
|
|
|
/**----------------------------------------------------------------------------
|
|
|
|
Include Files and Type Defines
|
|
|
|
----------------------------------------------------------------------------**/
|
|
|
|
#include "ocrfeatures.h"
|
|
|
|
|
|
|
|
/* Enumerate the different types of features currently defined. */
|
|
|
|
#define NUM_FEATURE_TYPES 4
|
2012-02-02 10:57:42 +08:00
|
|
|
extern const char* kMicroFeatureType;
|
|
|
|
extern const char* kCNFeatureType;
|
|
|
|
extern const char* kIntFeatureType;
|
|
|
|
extern const char* kGeoFeatureType;
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
/* define error traps which can be triggered by this module.*/
|
|
|
|
#define ILLEGAL_SHORT_NAME 2000
|
|
|
|
|
|
|
|
/* A character is described by multiple sets of extracted features. Each
|
|
|
|
set contains a number of features of a particular type, for example, a
|
|
|
|
set of bays, or a set of closures, or a set of microfeatures. Each
|
|
|
|
feature consists of a number of parameters. All features within a
|
|
|
|
feature set contain the same number of parameters.*/
|
|
|
|
|
2010-11-24 02:34:14 +08:00
|
|
|
struct CHAR_DESC_STRUCT {
|
Use POSIX data types and macros (#878)
* 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>
2018-03-14 04:36:30 +08:00
|
|
|
uint32_t NumFeatureSets;
|
2007-03-08 04:03:40 +08:00
|
|
|
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES];
|
2010-11-24 02:34:14 +08:00
|
|
|
};
|
2007-03-08 04:03:40 +08:00
|
|
|
typedef CHAR_DESC_STRUCT *CHAR_DESC;
|
|
|
|
|
2010-11-24 02:34:14 +08:00
|
|
|
struct FEATURE_DEFS_STRUCT {
|
Use POSIX data types and macros (#878)
* 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>
2018-03-14 04:36:30 +08:00
|
|
|
int32_t NumFeatureTypes;
|
2010-11-24 02:34:14 +08:00
|
|
|
const FEATURE_DESC_STRUCT* FeatureDesc[NUM_FEATURE_TYPES];
|
2007-03-08 04:03:40 +08:00
|
|
|
int FeatureEnabled[NUM_FEATURE_TYPES];
|
2010-11-24 02:34:14 +08:00
|
|
|
};
|
2007-03-08 04:03:40 +08:00
|
|
|
typedef FEATURE_DEFS_STRUCT *FEATURE_DEFS;
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Generic functions for manipulating character descriptions
|
|
|
|
----------------------------------------------------------------------*/
|
2010-11-24 02:34:14 +08:00
|
|
|
void InitFeatureDefs(FEATURE_DEFS_STRUCT *featuredefs);
|
|
|
|
|
2007-03-08 04:03:40 +08:00
|
|
|
void FreeCharDescription(CHAR_DESC CharDesc);
|
|
|
|
|
2010-11-24 02:34:14 +08:00
|
|
|
CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2012-02-02 10:57:42 +08:00
|
|
|
bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs,
|
|
|
|
CHAR_DESC CharDesc);
|
|
|
|
|
2015-05-13 06:22:34 +08:00
|
|
|
void WriteCharDescription(const FEATURE_DEFS_STRUCT& FeatureDefs,
|
|
|
|
CHAR_DESC CharDesc, STRING* str);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2010-11-24 02:34:14 +08:00
|
|
|
CHAR_DESC ReadCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs,
|
|
|
|
FILE *File);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2017-07-15 00:30:14 +08:00
|
|
|
uint32_t ShortNameToFeatureType(const FEATURE_DEFS_STRUCT &FeatureDefs,
|
|
|
|
const char *ShortName);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
/**----------------------------------------------------------------------------
|
|
|
|
Global Data Definitions and Declarations
|
|
|
|
----------------------------------------------------------------------------**/
|
2010-11-24 02:34:14 +08:00
|
|
|
extern const FEATURE_DESC_STRUCT MicroFeatureDesc;
|
2016-12-17 21:19:35 +08:00
|
|
|
extern TESS_API const FEATURE_DESC_STRUCT PicoFeatDesc;
|
2010-11-24 02:34:14 +08:00
|
|
|
extern const FEATURE_DESC_STRUCT CharNormDesc;
|
|
|
|
extern const FEATURE_DESC_STRUCT OutlineFeatDesc;
|
2012-02-02 10:57:42 +08:00
|
|
|
extern const FEATURE_DESC_STRUCT IntFeatDesc;
|
|
|
|
extern const FEATURE_DESC_STRUCT GeoFeatDesc;
|
2007-03-08 04:03:40 +08:00
|
|
|
#endif
|