/******************************************************************************
** Filename: adaptmatch.c
** Purpose: High level adaptive matcher.
** Author: Dan Johnson
** History: Mon Mar 11 10:00:10 1991, 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.
******************************************************************************/
/**----------------------------------------------------------------------------
Include Files and Type Defines
----------------------------------------------------------------------------**/
#include <ctype.h>
#include "adaptmatch.h"
#include "normfeat.h"
#include "mfoutline.h"
#include "picofeat.h"
#include "float2int.h"
#include "outfeat.h"
#include "emalloc.h"
#include "intfx.h"
#include "permnum.h"
#include "speckle.h"
#include "efio.h"
#include "normmatch.h"
#include "stopper.h"
#include "permute.h"
#include "context.h"
#include "ndminx.h"
#include "intproto.h"
#include "const.h"
#include "globals.h"
#include "werd.h"
#include "callcpp.h"
#include "tordvars.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#ifdef __UNIX__
#include <assert.h>
#endif
#define ADAPT_TEMPLATE_SUFFIX ".a"
#define BUILT_IN_TEMPLATES_FILE "inttemp"
#define BUILT_IN_CUTOFFS_FILE "pffmtable"
#define MAX_MATCHES 10
#define UNLIKELY_NUM_FEAT 200
#define NO_DEBUG 0
#define MAX_ADAPTABLE_WERD_SIZE 40
#define ADAPTABLE_WERD (GOOD_NUMBER + 0.05)
#define Y_DIM_OFFSET (Y_SHIFT - BASELINE_Y_SHIFT)
#define WORST_POSSIBLE_RATING (1.0)
typedef struct
{
INT32 BlobLength;
int NumMatches;
CLASS_ID Classes[MAX_NUM_CLASSES];
FLOAT32 Ratings[MAX_CLASS_ID + 1];
UINT8 Configs[MAX_CLASS_ID + 1];
FLOAT32 BestRating;
CLASS_ID BestClass;
UINT8 BestConfig;
}
ADAPT_RESULTS;
typedef struct
{
ADAPT_TEMPLATES Templates;
CLASS_ID ClassId;
int ConfigId;
}
PROTO_KEY;
/**----------------------------------------------------------------------------
Private Macros
----------------------------------------------------------------------------**/
#define MarginalMatch(Rating) \
((Rating) > GreatAdaptiveMatch)
#define TempConfigReliable(Config) \
((Config)->NumTimesSeen >= ReliableConfigThreshold)
#define InitIntFX() (FeaturesHaveBeenExtracted = FALSE)
/**----------------------------------------------------------------------------
Private Function Prototypes
----------------------------------------------------------------------------**/
void AdaptToChar(TBLOB *Blob,
LINE_STATS *LineStats,
CLASS_ID ClassId,
FLOAT32 Threshold);
void AdaptToPunc(TBLOB *Blob,
LINE_STATS *LineStats,
CLASS_ID ClassId,
FLOAT32 Threshold);
void AddNewResult(ADAPT_RESULTS *Results,
CLASS_ID ClassId,
FLOAT32 Rating,
int ConfigId);
void AmbigClassifier(TBLOB *Blob,
LINE_STATS *LineStats,
INT_TEMPLATES Templates,
UNICHAR_ID *Ambiguities,
ADAPT_RESULTS *Results);
UNICHAR_ID *BaselineClassifier(TBLOB *Blob,
LINE_STATS *LineStats,
ADAPT_TEMPLATES Templates,
ADAPT_RESULTS *Results);
void make_config_pruner(INT_TEMPLATES templates, CONFIG_PRUNER *config_pruner);
void CharNormClassifier(TBLOB *Blob,
LINE_STATS *LineStats,
INT_TEMPLATES Templates,
ADAPT_RESULTS *Results);
void ClassifyAsNoise(TBLOB *Blob,
LINE_STATS *LineStats,
ADAPT_RESULTS *Results);
//CLASS_ID *Class1,
int CompareCurrentRatings(const void *arg1,
const void *arg2); //CLASS_ID *Class2);
LIST ConvertMatchesToChoices(ADAPT_RESULTS *Results);
void DebugAdaptiveClassifier(TBLOB *Blob,
LINE_STATS *LineStats,
ADAPT_RESULTS *Results);
void DoAdaptiveMatch(TBLOB *Blob,
LINE_STATS *LineStats,
ADAPT_RESULTS *Results);
void GetAdaptThresholds (TWERD * Word,
LINE_STATS * LineStats,
const WERD_CHOICE& BestChoice,
const WERD_CHOICE& BestRawChoice, FLOAT32 Thresholds[]);
UNICHAR_ID *GetAmbiguities(TBLOB *Blob,
LINE_STATS *LineStats,
CLASS_ID CorrectClass);
int GetBaselineFeatures(TBLOB *Blob,
LINE_STATS *LineStats,
INT_TEMPLATES Templates,
INT_FEATURE_ARRAY IntFeatures,
CLASS_NORMALIZATION_ARRAY CharNormArray,
INT32 *BlobLength);
FLOAT32 GetBestRatingFor(TBLOB *Blob, LINE_STATS *LineStats, CLASS_ID ClassId);
int GetCharNormFeatures(TBLOB *Blob,
LINE_STATS *LineStats,
INT_TEMPLATES Templates,
INT_FEATURE_ARRAY IntFeatures,
CLASS_NORMALIZATION_ARRAY CharNormArray,
INT32 *BlobLength);
int GetIntBaselineFeatures(TBLOB *Blob,
LINE_STATS *LineStats,
INT_TEMPLATES Templates,
INT_FEATURE_ARRAY IntFeatures,
CLASS_NORMALIZATION_ARRAY CharNormArray,
INT32 *BlobLength);
int GetIntCharNormFeatures(TBLOB *Blob,
LINE_STATS *LineStats,
INT_TEMPLATES Templates,
INT_FEATURE_ARRAY IntFeatures,
CLASS_NORMALIZATION_ARRAY CharNormArray,
INT32 *BlobLength);
void InitMatcherRatings(register FLOAT32 *Rating);
int MakeNewTemporaryConfig(ADAPT_TEMPLATES Templates,
CLASS_ID ClassId,
int NumFeatures,
INT_FEATURE_ARRAY Features,
FEATURE_SET FloatFeatures);
PROTO_ID MakeNewTempProtos (FEATURE_SET Features,
int NumBadFeat,
FEATURE_ID BadFeat[],
INT_CLASS IClass,
ADAPT_CLASS Class, BIT_VECTOR TempProtoMask);
void MakePermanent(ADAPT_TEMPLATES Templates,
CLASS_ID ClassId,
int ConfigId,
TBLOB *Blob,
LINE_STATS *LineStats);
int MakeTempProtoPerm(void *item1, void *item2);
int NumBlobsIn(TWERD *Word);
int NumOutlinesInBlob(TBLOB *Blob);
void PrintAdaptiveMatchResults(FILE *File, ADAPT_RESULTS *Results);
void RemoveBadMatches(ADAPT_RESULTS *Results);
void RemoveExtraPuncs(ADAPT_RESULTS *Results);
void SetAdaptiveThreshold(FLOAT32 Threshold);
void ShowBestMatchFor(TBLOB *Blob,
LINE_STATS *LineStats,
CLASS_ID ClassId,
BOOL8 AdaptiveOn,
BOOL8 PreTrainedOn);
/*
#if defined(__STDC__) || defined(__cplusplus)
# define _ARGS(s) s
#else
# define _ARGS(s) ()
#endif*/
/* /users/danj/wiseowl/src/danj/microfeatures/adaptmatch.c
int AdaptableWord
_ARGS((TWERD *Word,
char *BestChoice,
char *BestRawChoice));
void AdaptToChar
_ARGS((BLOB *Blob,
LINE_STATS *LineSt
没有合适的资源?快使用搜索试试~ 我知道了~
tesseract-2.01.rar_01数字识别_OCR 数字_OCR文字识别_tesseract-ocr_数字OCR
共590个文件
h:254个
cpp:218个
in:20个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 89 浏览量
2022-07-15
03:11:47
上传
评论 1
收藏 3.15MB RAR 举报
温馨提示
ocr源码 文字、英文、数字智能识别,已经配置好的tesseract-2.01,采用vc6.0编译,使用方法见里面说明,不压缩的tif和单色bmp识别
资源详情
资源评论
资源推荐
收起资源包目录
tesseract-2.01.rar_01数字识别_OCR 数字_OCR文字识别_tesseract-ocr_数字OCR (590个子文件)
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 932B
Makefile.am 864B
Makefile.am 728B
Makefile.am 557B
Makefile.am 489B
Makefile.am 463B
Makefile.am 313B
Makefile.am 277B
Makefile.am 177B
Makefile.am 166B
Makefile.am 142B
Makefile.am 58B
api_config 26B
AUTHORS 170B
batch 50B
tesseractfull.cc 1KB
ChangeLog 2KB
configure 242KB
confsets 9B
COPYING 1KB
adaptmatch.cpp 111KB
cluster.cpp 105KB
makerow.cpp 98KB
intmatcher.cpp 80KB
topitch.cpp 74KB
tospace.cpp 69KB
oldbasel.cpp 66KB
pgedit.cpp 64KB
control.cpp 61KB
fpchop.cpp 58KB
intproto.cpp 58KB
reject.cpp 58KB
imgs.cpp 55KB
docqual.cpp 49KB
stopper.cpp 47KB
permute.cpp 44KB
output.cpp 44KB
memblk.cpp 39KB
baseapi.cpp 36KB
mfoutline.cpp 35KB
werd.cpp 34KB
adaptions.cpp 34KB
grphics.cpp 34KB
tordmain.cpp 34KB
mfTraining.cpp 33KB
fixspace.cpp 33KB
applybox.cpp 30KB
fixxht.cpp 29KB
statistc.cpp 29KB
ocrshell.cpp 27KB
kdtree.cpp 27KB
pithsync.cpp 26KB
blobbox.cpp 26KB
blkocc.cpp 26KB
imgtiff.cpp 24KB
cnTraining.cpp 24KB
pageblk.cpp 23KB
charcut.cpp 23KB
varable.cpp 23KB
chopper.cpp 22KB
wordseg.cpp 22KB
blread.cpp 21KB
trie.cpp 20KB
pagewalk.cpp 20KB
polyaprx.cpp 20KB
coutln.cpp 19KB
elst2.cpp 19KB
elst.cpp 19KB
clst.cpp 19KB
sbdmenu.cpp 18KB
tfacepp.cpp 18KB
findseam.cpp 18KB
charsample.cpp 17KB
memry.cpp 17KB
tstruct.cpp 17KB
clusttool.cpp 17KB
adaptive.cpp 17KB
drawtord.cpp 17KB
mfx.cpp 17KB
permnum.cpp 17KB
bestfirst.cpp 16KB
grphshm.cpp 16KB
pitsync1.cpp 16KB
edgblob.cpp 15KB
ocrblock.cpp 15KB
debugwin.cpp 15KB
tessbox.cpp 15KB
scanedg.cpp 15KB
intfx.cpp 15KB
seam.cpp 15KB
chop.cpp 14KB
protos.cpp 14KB
scanutils.cpp 14KB
lmedsq.cpp 14KB
共 590 条
- 1
- 2
- 3
- 4
- 5
- 6
JaniceLu
- 粉丝: 78
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论11