Initialization of the Single Character Recognition Class
Initialize the single character recognition and prepare for recognition.
// Set the instance of the pattern class
void msetpattern(CJocrPattern* pattern);
Input:
CJocrPattern* pattern; The constructed and initialized pattern class
// Set the instance of the dictionary class
void msetdict(CJocrDict* pdict);
Input:
CJocrDict* pdict; The constructed and initialized dictionary class
// Allocate memory
int mallocmemory();
Return Value:
0..............Normal termination
MEMORY_SHORTAGE...Memory shortage
Example
#include "ocrdef.h"
#include "ocrco.h"
#include "cjocrstock.h"
#include "cjocrdict98.h"
#include "cjocrpat98.h"
#include "cjocrrec98.h"
#include "errcode.h"
...
....
// Create the pattern class
CJocrPattern* pattern = new CJocrPattern;
int ret = pattern->mallocmemory();
if(ret < 0) {
printf("Pattern class memory allocation error");
delete pattern;
exit(1);
}
// Create the 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(0);
}
// Create the recognition class
// Create an instance by specifying a 20-digit code supplied by the library licenser
CJocrRecognize* precognize = new CJocrRecognize("ABCDEFGHJKLMNPQ23456");
// In the case of a license code file, CJocrRecognize* precognize = new CJocrRecognize("C:\\Program Files\\Foo\\jocr.kcd");
precognize->msetpattern(pattern);
precognize->msetdict(pjocrdict);
// Initialize the recognition class
ret = precognize->mallocmemory();
if(ret < 0) {
printf("Error");
}
delete precognzie;
delete pjocrdict;
delete pattern;