Initialize the paragraph recognition class
// Set processing method
void msetprocess(int preprocess);
Input
int preprocess; PREPROCESS_EXACT Cut out the inside of the paragraph rectangle as a bitmap for recognition
PREPROCESS_INSIDE Recognize primitives that are completely inside the paragraph rectangle
Primitives that touch the frame of the paragraph rectangle are excluded
// Set the instance of the line recognition class with language processing
void msetlang(CJocrLang* pjocrlang);
Input
CJocrLang* pjocrlang; Instance of initialized line recognition class with language processing
#include "ocrdef.h"
#include "ocrco.h"
#include "cjocrstock.h"
#include "cjocrdict98.h"
#include "cjocrpat98.h"
#include "cjocrrec98.h"
#include "cjocrline98.h"
#include "cjocrlang.h"
#include "cjocrblock.h"
#include "errcode.h"
...
....
// Create pattern class
CJocrPattern* pattern = new CJocrPattern;
int ret = pattern->mallocmemory();
if(ret < 0) {
printf("Pattern class memory allocation error");
delete pattern;
exit(1);
}
// Create dictionary class
CJocrDict* pjocrdict = new CJocrDict;
pjocrdict->msetsystemdict("c:\\dic\\feature\\system");
pjocrdict->msetsystemdict("c:\\dic\\feature\\systemfat");
pjocrdict->msetuserdict("c:\\dic\\feature\\user");
ret = pjocrdict->mloaddict();
if(ret < 0) {
printf("Error");
delete pjocrdict;
delete pattern;
exit(1);
}
// Create single character recognition class
CJocrRecognize* precognize = new CJocrRecognize;
precognize->msetpatter(pattern);
precognize->msetdict(pjocrdict);
// Initialize single character recognition class
ret = precognize->mallocmemory();
if(ret < 0) {
printf("Error");
delete precognize;
delete pjocrdict;
delete pattern;
exit(1);
}
// Create line recognition class with language processing
CJocrLang* pjocrlang = new CJocrLang;
pjocrlang->msetpatter(pattern);
pjocrlang->msetrecognize(precognize);
// Create paragraph recognition class
CJocrBlock* pjocrblock = new CJocrBlock;
pjocrblock->msetlang(pjocrlang);
pjocrblock->msetprocess(PREPROCESS_INSIDE); // Exclude primitives that touch the frame
....
...
..
delete pjocrblock;
delete pjocrlang;
delete precognize;
delete pjocrdict;
delete pattern;