Get Pattern Image
Get the pattern image at the current seek position in the user dictionary.
int mgetpattern(UINT32& recordsize, char* record);
Input:
UINT32& recordsize; size of the record buffer
UINT32 is unsigned int
char* record; buffer to receive the record
Output:
UINT32& recordsize; size of the retrieved record
Return Value:
1.....successful retrieval
0.....not found
Negative value....BUFFER_OVERFLOW
The size of the pattern exceeds recordsize.
In this case, the actual record size is assigned
to recordsize and returned.
48 x 48 pixels is the standard size for NGKOCR normalization. Since the image is 1 pixel per bit, a buffer of 288 bytes is required (48 x 48 / 8). The size of the pattern image is defined as REG_FONT_SIZE in ocrdef.h.
Example
#include "ocrdef.h"
#include "ocrco.h"
#include "cjocrstock.h"
#include "cjocrdict98.h"
#include "errcode.h"
...
....
CJocrDict* pjocrdict = new CJocrDict;
pjocrdict->msetsystemdict("c:\\dic\\feature\\system");
pjocrdict->msetsystemdict("c:\\dic\\feature\\systemfat");
pjocrdict->msetuserdict("c:\\dic\\feature\\user");
int ret = pjocrdict->mloaddict();
if (ret < 0) {
printf("Error");
}
ret = pjocrdict->mseekhead();
if (ret < 0) {
printf("Error");
}
else if (ret == 0) {
printf("No record in the user dictionary");
}
else {
UINT32 recordsize = REG_FONT_SIZE; // size of the record buffer
char record[KEYSIZE_MAX]; // buffer to receive the record
ret = pjocrdict->mgetpattern(recordsize, record);
if (ret < 0) {
printf("Error");
}
else {
// the pattern of 48 x 48 pixels is in the record
}
}
delete pjocrdict;