93 #include <config_auto.h>
97 #include "allheaders.h"
101 #define SPLIT_WITH_DID 1
104 static const l_int32 LeftRightPadding = 32;
107 static const l_float32 MinFillFactor = 0.10;
108 static const l_int32 DefaultMinHeight = 15;
109 static const l_int32 MinOverlap1 = 6;
110 static const l_int32 MinOverlap2 = 6;
111 static const l_int32 MinHeightPass1 = 5;
115 NUMA *namoment1, l_int32 area2,
116 l_int32 ycent2, l_int32 maxyshift,
117 l_int32 *tab8, l_int32 *pdelx,
118 l_int32 *pdely, l_float32 *pscore,
120 static L_RCH *
rchCreate(l_int32 index, l_float32 score,
char *text,
121 l_int32 sample, l_int32 xloc, l_int32 yloc,
126 l_float32 minaf, l_int32 debug);
128 l_float32 minaf, l_int32 *premove,
176 PROCNAME(
"recogIdentifyMultiple");
178 if (pboxa) *pboxa = NULL;
179 if (ppixa) *ppixa = NULL;
180 if (ppixdb) *ppixdb = NULL;
182 return ERROR_INT(
"recog not defined", procName, 2);
184 return ERROR_INT(
"training not finished", procName, 2);
186 return ERROR_INT(
"pixs not defined", procName, 2);
189 if (pixGetDepth(pixs) > 1)
201 L_WARNING(
"nothing found\n", procName);
258 static l_int32 ind = 0;
260 l_int32 i, xoff, yoff, empty, maxw, bw, ncomp, scaling;
262 BOXA *boxa1, *boxa2, *boxa3, *boxa4, *boxad;
264 PIX *pix, *pix1, *pix2, *pix3;
267 PROCNAME(
"recogSplitIntoCharacters");
271 if (pboxa) *pboxa = NULL;
272 if (ppixa) *ppixa = NULL;
273 if (!pboxa || !ppixa)
274 return ERROR_INT(
"&boxa and &pixa not defined", procName, 1);
276 return ERROR_INT(
"recog not defined", procName, 1);
278 return ERROR_INT(
"training not finished", procName, 1);
279 if (!pixs || pixGetDepth(pixs) != 1)
280 return ERROR_INT(
"pixs not defined or not 1 bpp", procName, 1);
281 if (minh <= 0) minh = DefaultMinHeight;
299 L_WARNING(
"all components removed\n", procName);
306 scaling = (recog->
scalew > 0 || recog->
scaleh > 0) ? TRUE : FALSE;
308 for (i = 0; i < ncomp; i++) {
313 if (bw <= maxw || scaling || skipsplit) {
336 L_ERROR(
"boxa3 not found for component %d\n", procName, i);
348 snprintf(buf,
sizeof(buf),
"/tmp/lept/recog/decode-%d.png", ind++);
349 pixWrite(buf, pix3, IFF_PNG);
359 baa =
boxaSort2d(boxa2, NULL, MinOverlap1, MinOverlap2, MinHeightPass1);
414 l_int32 index, remove, w, h, bx, bw, bxc, bwc, w1, w2, w3;
416 BOX *box, *boxc, *boxtrans, *boxl, *boxr, *boxlt, *boxrt;
418 NUMA *nascoret, *naindext, *nasort;
419 PIX *pixb, *pixc, *pixl, *pixr, *pixdb, *pixd;
420 PIXA *pixar, *pixadb;
425 PROCNAME(
"recogCorrelationBestRow");
427 if (pnascore) *pnascore = NULL;
428 if (pnaindex) *pnaindex = NULL;
429 if (psachar) *psachar = NULL;
431 return ERROR_INT(
"&boxa not defined", procName, 1);
434 return ERROR_INT(
"recog not defined", procName, 1);
435 if (!pixs || pixGetDepth(pixs) != 1)
436 return ERROR_INT(
"pixs not defined or not 1 bpp", procName, 1);
437 if (pixGetWidth(pixs) < recog->
minwidth_u - 4)
438 return ERROR_INT(
"pixs too narrow", procName, 1);
440 return ERROR_INT(
"training not finished", procName, 1);
464 for (iter = 0; iter < 11; iter++) {
468 L_WARNING(
"more than 10 chars; ending search\n", procName);
479 lept_stderr(
"iter = %d, removed = %d\n", iter, remove);
489 &index, &charstr, &pixdb);
493 &index, &charstr, NULL);
511 lept_stderr(
" w1 = %d, w2 = %d, w3 = %d\n", w1, w2, w3);
512 if (w1 < recog->minwidth_u - 4) {
513 if (debug) L_INFO(
"discarding width %d on left\n", procName, w1);
522 if (w3 < recog->minwidth_u - 4) {
523 if (debug) L_INFO(
"discarding width %d on right\n", procName, w3);
525 boxr =
boxCreate(bx + bw - 1, 0, w3 + 1, h);
556 pixDisplay(pixd, 400, 400);
595 l_int32 i, n, w1, h1, w2, area2, ycent2, delx, dely;
596 l_int32 bestdelx, bestdely, bestindex;
597 l_float32 score, bestscore;
600 NUMA *nasum, *namoment;
603 PROCNAME(
"recogCorrelationBestChar");
605 if (pindex) *pindex = 0;
606 if (pcharstr) *pcharstr = NULL;
607 if (ppixdb) *ppixdb = NULL;
608 if (pbox) *pbox = NULL;
609 if (pscore) *pscore = 0.0;
610 if (!pbox || !pscore)
611 return ERROR_INT(
"&box and &score not both defined", procName, 1);
613 return ERROR_INT(
"recog not defined", procName, 1);
614 if (!pixs || pixGetDepth(pixs) != 1)
615 return ERROR_INT(
"pixs not defined or not 1 bpp", procName, 1);
617 return ERROR_INT(
"training not finished", procName, 1);
633 bestindex = bestdelx = bestdely = 0;
634 for (i = 0; i < n; i++) {
636 w2 = pixGetWidth(pix2);
647 "Best match template %d: (x,y) = (%d,%d), score = %5.3f\n",
648 i, delx, dely, score);
651 box =
boxCreate(delx - LeftRightPadding, 0, w2, h1);
652 if (score > bestscore) {
654 bestdelx = delx - LeftRightPadding;
661 lept_stderr(
"Component too thin: w1 = %d, w2 = %d\n", w1, w2);
669 if (pindex) *pindex = bestindex;
674 L_INFO(
"Best match: class %d; shifts (%d, %d)\n",
675 procName, bestindex, bestdelx, bestdely);
742 l_int32 w1, w2, h1, h2, i, j, nx, shifty, delx, dely;
743 l_int32 sum, moment, count;
744 l_int32 *tab, *area1, *arraysum, *arraymoment;
745 l_float32 maxscore, score;
748 PIX *pixt, *pixt1, *pixt2;
750 PROCNAME(
"pixCorrelationBestShift");
752 if (pdelx) *pdelx = 0;
753 if (pdely) *pdely = 0;
754 if (pscore) *pscore = 0.0;
755 if (!pix1 || pixGetDepth(pix1) != 1)
756 return ERROR_INT(
"pix1 not defined or not 1 bpp", procName, 1);
757 if (!pix2 || pixGetDepth(pix2) != 1)
758 return ERROR_INT(
"pix2 not defined or not 1 bpp", procName, 1);
759 if (!nasum1 || !namoment1)
760 return ERROR_INT(
"nasum1 and namoment1 not both defined", procName, 1);
761 if (area2 <= 0 || ycent2 <= 0)
762 return ERROR_INT(
"area2 and ycent2 must be > 0", procName, 1);
771 L_INFO(
"skipping match with w1 = %d and w2 = %d\n",
787 area1 = (l_int32 *)LEPT_CALLOC(nx,
sizeof(l_int32));
788 ycent1 = (l_float32 *)LEPT_CALLOC(nx,
sizeof(l_int32));
791 for (i = 0, sum = 0, moment = 0; i < w2; i++) {
793 moment += arraymoment[i];
795 for (i = 0; i < nx - 1; i++) {
797 ycent1[i] = (sum == 0) ? ycent2 : (l_float32)moment / (l_float32)sum;
798 sum += arraysum[w2 + i] - arraysum[i];
799 moment += arraymoment[w2 + i] - arraymoment[i];
802 ycent1[nx - 1] = (sum == 0) ? ycent2 : (l_float32)moment / (l_float32)sum;
815 for (i = 0; i < nx; i++) {
816 shifty = (l_int32)(ycent1[i] - ycent2 + 0.5);
817 for (j = -maxyshift; j <= maxyshift; j++) {
822 score = (l_float32)count * (l_float32)count /
823 ((l_float32)area1[i] * (l_float32)area2);
824 if (score > maxscore) {
840 snprintf(buf,
sizeof(buf),
"/tmp/lept/recog/junkbs_%d.png", debugflag);
841 pixWrite(buf, pixt2, IFF_PNG);
847 if (pdelx) *pdelx = delx;
848 if (pdely) *pdely = dely;
849 if (pscore) *pscore = maxscore;
850 if (!tab8) LEPT_FREE(tab);
854 LEPT_FREE(arraymoment);
887 l_int32 i, n, fail, index, depth;
889 PIX *pix1, *pix2, *pix3;
893 PROCNAME(
"recogIdentifyPixa");
895 if (ppixdb) *ppixdb = NULL;
897 return ERROR_INT(
"recog not defined", procName, 1);
899 return ERROR_INT(
"pixa not defined", procName, 1);
908 for (i = 0; i < n; i++) {
918 if ((rch = recog->
rch) == NULL) {
919 L_ERROR(
"rch not found for char %d\n", procName, i);
924 rchExtract(rch, NULL, NULL, &text, NULL, NULL, NULL, NULL);
928 rchExtract(rch, &index, &score, NULL, NULL, NULL, NULL, NULL);
930 if (i == 0) depth = pixGetDepth(pix3);
980 l_int32 i, j, n, bestindex, bestsample, area1, area2;
981 l_int32 shiftx, shifty, bestdelx, bestdely, bestwidth, maxyshift;
982 l_float32 x1, y1, x2, y2, delx, dely, score, maxscore;
984 PIX *pix0, *pix1, *pix2;
988 PROCNAME(
"recogIdentifyPix");
990 if (ppixdb) *ppixdb = NULL;
992 return ERROR_INT(
"recog not defined", procName, 1);
993 if (!pixs || pixGetDepth(pixs) != 1)
994 return ERROR_INT(
"pixs not defined or not 1 bpp", procName, 1);
1000 return ERROR_INT(
"averaging failed", procName, 1);
1005 return ERROR_INT(
"no fg pixels in pix0", procName, 1);
1011 return ERROR_INT(
"no fg pixels in pix1", procName, 1);
1017 bestindex = bestsample = bestdelx = bestdely = bestwidth = 0;
1021 for (i = 0; i < recog->
setsize; i++) {
1023 if (area2 == 0)
continue;
1028 for (shifty = -maxyshift; shifty <= maxyshift; shifty++) {
1029 for (shiftx = -maxyshift; shiftx <= maxyshift; shiftx++) {
1030 pixCorrelationScoreSimple(pix1, pix2, area1, area2,
1031 delx + shiftx, dely + shifty,
1032 5, 5, recog->
sumtab, &score);
1033 if (score > maxscore) {
1035 bestdelx = delx + shiftx;
1036 bestdely = dely + shifty;
1044 for (i = 0; i < recog->
setsize; i++) {
1053 for (j = 0; j < n; j++) {
1059 for (shifty = -maxyshift; shifty <= maxyshift; shifty++) {
1060 for (shiftx = -maxyshift; shiftx <= maxyshift; shiftx++) {
1061 pixCorrelationScoreSimple(pix1, pix2, area1, area2,
1062 delx + shiftx, dely + shifty,
1063 5, 5, recog->
sumtab, &score);
1064 if (score > maxscore) {
1067 bestdelx = delx + shiftx;
1068 bestdely = dely + shifty;
1070 bestwidth = pixGetWidth(pix2);
1085 recog->
rch =
rchCreate(bestindex, maxscore, text, bestsample,
1086 bestdelx, bestdely, bestwidth);
1090 L_INFO(
"Best match: str %s; class %d; sh (%d, %d); score %5.3f\n",
1091 procName, text, bestindex, bestdelx, bestdely, maxscore);
1094 L_INFO(
"Best match: str %s; sample %d in class %d; score %5.3f\n",
1095 procName, text, bestsample, bestindex, maxscore);
1096 if (maxyshift > 0 && (L_ABS(bestdelx) > 0 || L_ABS(bestdely) > 0)) {
1097 L_INFO(
" Best shift: (%d, %d)\n",
1098 procName, bestdelx, bestdely);
1126 PROCNAME(
"recogSkipIdentify");
1129 return ERROR_INT(
"recog not defined", procName, 1);
1176 PROCNAME(
"rchaDestroy");
1178 if (prcha == NULL) {
1179 L_WARNING(
"&rcha is null!\n", procName);
1182 if ((rcha = *prcha) == NULL)
1227 rch = (
L_RCH *)LEPT_CALLOC(1,
sizeof(
L_RCH));
1249 PROCNAME(
"rchDestroy");
1252 L_WARNING(
"&rch is null!\n", procName);
1255 if ((rch = *prch) == NULL)
1257 LEPT_FREE(rch->
text);
1292 PROCNAME(
"rchaExtract");
1294 if (pnaindex) *pnaindex = NULL;
1295 if (pnascore) *pnascore = NULL;
1296 if (psatext) *psatext = NULL;
1297 if (pnasample) *pnasample = NULL;
1298 if (pnaxloc) *pnaxloc = NULL;
1299 if (pnayloc) *pnayloc = NULL;
1300 if (pnawidth) *pnawidth = NULL;
1302 return ERROR_INT(
"rcha not defined", procName, 1);
1338 PROCNAME(
"rchExtract");
1340 if (pindex) *pindex = 0;
1341 if (pscore) *pscore = 0.0;
1342 if (ptext) *ptext = NULL;
1343 if (psample) *psample = 0;
1344 if (pxloc) *pxloc = 0;
1345 if (pyloc) *pyloc = 0;
1346 if (pwidth) *pwidth = 0;
1348 return ERROR_INT(
"rch not defined", procName, 1);
1350 if (pindex) *pindex = rch->
index;
1351 if (pscore) *pscore = rch->
score;
1353 if (psample) *psample = rch->
sample;
1354 if (pxloc) *pxloc = rch->
xloc;
1355 if (pyloc) *pyloc = rch->
yloc;
1356 if (pwidth) *pwidth = rch->
width;
1379 PROCNAME(
"transferRchToRcha");
1382 return ERROR_INT(
"rch not defined", procName, 1);
1384 return ERROR_INT(
"rcha not defined", procName, 1);
1422 PIX *pix1, *pix2, *pixd;
1424 PROCNAME(
"recogProcessToIdentify");
1427 return (
PIX *)ERROR_PTR(
"recog not defined", procName, NULL);
1429 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
1431 if (pixGetDepth(pixs) != 1)
1442 return (
PIX *)ERROR_PTR(
"no foreground pixels", procName, NULL);
1467 l_int32 scaling, minsplitw, maxsplith, maxasp;
1469 NUMA *naw, *nah, *na1, *na1c, *na2, *na3, *na4, *na5, *na6, *na7;
1473 PROCNAME(
"recogPreSplittingFilter");
1476 return (
PIX *)ERROR_PTR(
"recog not defined", procName, NULL);
1478 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
1482 scaling = (recog->
scalew > 0 || recog->
scaleh > 0) ? TRUE : FALSE;
1483 minsplitw = (scaling) ? 1 : recog->
min_splitw - 3;
1484 maxsplith = (scaling) ? 150 : recog->
max_splith;
1546 l_float32 aspratio, fract;
1548 PROCNAME(
"recogSplittingFilter");
1551 return ERROR_INT(
"&remove not defined", procName, 1);
1554 return ERROR_INT(
"recog not defined", procName, 1);
1556 return ERROR_INT(
"pixs not defined", procName, 1);
1557 if (minh <= 0) minh = DefaultMinHeight;
1564 if (w < recog->min_splitw) {
1565 if (debug) L_INFO(
"w = %d < %d\n", procName, w, recog->
min_splitw);
1570 if (debug) L_INFO(
"h = %d < %d\n", procName, h, minh);
1574 aspratio = (l_float32)w / (l_float32)h;
1576 if (debug) L_INFO(
"w/h = %5.3f too large\n", procName, aspratio);
1581 if (fract < minaf) {
1582 if (debug) L_INFO(
"area fill fract %5.3f < %5.3f\n",
1583 procName, fract, minaf);
1632 l_float32 scorethresh,
1633 l_int32 spacethresh,
1638 l_int32 i, n, x1, x2, h_ovl, v_ovl, h_sep, v_sep;
1645 SARRAY *satext, *sa, *saout;
1647 PROCNAME(
"recogExtractNumbers");
1649 if (pbaa) *pbaa = NULL;
1650 if (pnaa) *pnaa = NULL;
1651 if (!recog || !recog->
rcha)
1652 return (
SARRAY *)ERROR_PTR(
"recog and rcha not both defined",
1655 return (
SARRAY *)ERROR_PTR(
"boxas not defined", procName, NULL);
1657 if (spacethresh < 0)
1659 rchaExtract(recog->
rcha, NULL, &nascore, &satext, NULL, NULL, NULL, NULL);
1660 if (!nascore || !satext) {
1663 return (
SARRAY *)ERROR_PTR(
"nascore and satext not both returned",
1672 for (i = 0; i < n; i++) {
1675 if (prebox == NULL) {
1676 if (score < scorethresh) {
1695 if (x1 < x2 && h_sep <= spacethresh &&
1696 v_sep < 0 && score >= scorethresh) {
1708 if (score >= scorethresh) {
1731 L_INFO(
"saout has no identified text\n", procName);
1772 char *textstr, *scorestr;
1773 l_int32 i, j, n, nchar, len;
1779 PIX *pix1, *pix2, *pix3, *pix4;
1782 PROCNAME(
"showExtractNumbers");
1784 if (ppixdb) *ppixdb = NULL;
1786 return (
PIXA *)ERROR_PTR(
"pixs not defined", procName, NULL);
1788 return (
PIXA *)ERROR_PTR(
"sa not defined", procName, NULL);
1790 return (
PIXA *)ERROR_PTR(
"baa not defined", procName, NULL);
1792 return (
PIXA *)ERROR_PTR(
"naa not defined", procName, NULL);
1798 for (i = 0; i < n; i++) {
1806 len = strlen(textstr) + 1;
1812 for (j = 0; j < nchar; j++) {
1814 snprintf(buf,
sizeof(buf),
"%d", (l_int32)(100 * score));
1818 snprintf(buf,
sizeof(buf),
"%s: %s\n", textstr, scorestr);
1828 LEPT_FREE(scorestr);
1862 lept_stderr(
"================================================\n");
1864 for (i = 0; i < n; i++)
1867 for (i = 0; i < n; i++)
1870 for (i = 0; i < n; i++)
1873 for (i = 0; i < n; i++)
1876 for (i = 0; i < n; i++)
1878 lept_stderr(
"\n------------------------------------------------");
1880 for (i = 0; i < n; i++)
1882 lept_stderr(
"\n================================================\n");
void bmfDestroy(L_BMF **pbmf)
bmfDestroy()
L_BMF * bmfCreate(const char *dir, l_int32 fontsize)
bmfCreate()
void boxDestroy(BOX **pbox)
boxDestroy()
BOXAA * boxaaCreate(l_int32 n)
boxaaCreate()
l_int32 boxaGetCount(BOXA *boxa)
boxaGetCount()
l_ok boxaaAddBoxa(BOXAA *baa, BOXA *ba, l_int32 copyflag)
boxaaAddBoxa()
l_ok boxGetGeometry(BOX *box, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxGetGeometry()
l_ok boxaAddBox(BOXA *boxa, BOX *box, l_int32 copyflag)
boxaAddBox()
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
BOXA * boxaaGetBoxa(BOXAA *baa, l_int32 index, l_int32 accessflag)
boxaaGetBoxa()
BOX * boxaGetBox(BOXA *boxa, l_int32 index, l_int32 accessflag)
boxaGetBox()
void boxaaDestroy(BOXAA **pbaa)
boxaaDestroy()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
BOXA * boxaCreate(l_int32 n)
boxaCreate()
l_ok boxaJoin(BOXA *boxad, BOXA *boxas, l_int32 istart, l_int32 iend)
boxaJoin()
l_ok boxOverlapDistance(BOX *box1, BOX *box2, l_int32 *ph_ovl, l_int32 *pv_ovl)
boxOverlapDistance()
BOXA * boxaHandleOverlaps(BOXA *boxas, l_int32 op, l_int32 range, l_float32 min_overlap, l_float32 max_ratio, NUMA **pnamap)
boxaHandleOverlaps()
BOX * boxAdjustSides(BOX *boxd, BOX *boxs, l_int32 delleft, l_int32 delright, l_int32 deltop, l_int32 delbot)
boxAdjustSides()
BOX * boxTransform(BOX *box, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley)
boxTransform()
BOXA * boxaTransform(BOXA *boxas, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley)
boxaTransform()
BOXA * boxaaFlattenToBoxa(BOXAA *baa, NUMA **pnaindex, l_int32 copyflag)
boxaaFlattenToBoxa()
BOXA * boxaSort(BOXA *boxas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex)
boxaSort()
BOXAA * boxaSort2d(BOXA *boxas, NUMAA **pnaad, l_int32 delta1, l_int32 delta2, l_int32 minh1)
boxaSort2d()
l_ok boxaGetExtent(BOXA *boxa, l_int32 *pw, l_int32 *ph, BOX **pbox)
boxaGetExtent()
BOXA * pixConnComp(PIX *pixs, PIXA **ppixa, l_int32 connectivity)
pixConnComp()
l_ok fpixSetPixel(FPIX *fpix, l_int32 x, l_int32 y, l_float32 val)
fpixSetPixel()
void fpixDestroy(FPIX **pfpix)
fpixDestroy()
FPIX * fpixCreate(l_int32 width, l_int32 height)
fpixCreate()
PIX * fpixDisplayMaxDynamicRange(FPIX *fpixs)
fpixDisplayMaxDynamicRange()
l_ok pixRenderBoxArb(PIX *pix, BOX *box, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderBoxArb()
l_ok pixRenderBoxaArb(PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderBoxaArb()
PIX * pixThresholdToBinary(PIX *pixs, l_int32 thresh)
pixThresholdToBinary()
l_ok pixCentroid(PIX *pix, l_int32 *centtab, l_int32 *sumtab, l_float32 *pxave, l_float32 *pyave)
pixCentroid()
PIX * pixMorphSequence(PIX *pixs, const char *sequence, l_int32 dispsep)
pixMorphSequence()
l_ok numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
l_ok numaGetFValue(NUMA *na, l_int32 index, l_float32 *pval)
numaGetFValue()
NUMA * numaCreate(l_int32 n)
numaCreate()
NUMA * numaaGetNuma(NUMAA *naa, l_int32 index, l_int32 accessflag)
numaaGetNuma()
NUMA * numaClone(NUMA *na)
numaClone()
void numaDestroy(NUMA **pna)
numaDestroy()
NUMAA * numaaCreate(l_int32 n)
numaaCreate()
l_int32 numaGetCount(NUMA *na)
numaGetCount()
l_ok numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_ok numaaAddNuma(NUMAA *naa, NUMA *na, l_int32 copyflag)
numaaAddNuma()
NUMA * numaCopy(NUMA *na)
numaCopy()
l_int32 * numaGetIArray(NUMA *na)
numaGetIArray()
void numaaDestroy(NUMAA **pnaa)
numaaDestroy()
NUMA * numaMakeThresholdIndicator(NUMA *nas, l_float32 thresh, l_int32 type)
numaMakeThresholdIndicator()
NUMA * numaLogicalOp(NUMA *nad, NUMA *na1, NUMA *na2, l_int32 op)
numaLogicalOp()
NUMA * numaSortByIndex(NUMA *nas, NUMA *naindex)
numaSortByIndex()
void pixDestroy(PIX **ppix)
pixDestroy()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
l_ok pixSetText(PIX *pix, const char *textstring)
pixSetText()
PIX * pixCopy(PIX *pixd, const PIX *pixs)
pixCopy()
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
PIX * pixClone(PIX *pixs)
pixClone()
l_ok pixClearAll(PIX *pix)
pixClearAll()
PIX * pixAddBorderGeneral(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_uint32 val)
pixAddBorderGeneral()
PIX * pixAddBlackOrWhiteBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_int32 op)
pixAddBlackOrWhiteBorder()
l_ok pixZero(PIX *pix, l_int32 *pempty)
pixZero()
l_ok pixCountPixels(PIX *pixs, l_int32 *pcount, l_int32 *tab8)
pixCountPixels()
NUMA * pixCountPixelsByColumn(PIX *pix)
pixCountPixelsByColumn()
NUMA * pixGetMomentByColumn(PIX *pix, l_int32 order)
pixGetMomentByColumn()
l_int32 * makePixelSumTab8(void)
makePixelSumTab8()
NUMA * pixaFindAreaFraction(PIXA *pixa)
pixaFindAreaFraction()
l_ok pixFindAreaFraction(PIX *pixs, l_int32 *tab, l_float32 *pfract)
pixFindAreaFraction()
PIX * pixClipRectangle(PIX *pixs, BOX *box, BOX **pboxc)
pixClipRectangle()
l_ok pixTestClipToForeground(PIX *pixs, l_int32 *pcanclip)
pixTestClipToForeground()
NUMA * pixaFindWidthHeightRatio(PIXA *pixa)
pixaFindWidthHeightRatio()
l_ok pixClipToForeground(PIX *pixs, PIX **ppixd, BOX **pbox)
pixClipToForeground()
l_ok pixaFindDimensions(PIXA *pixa, NUMA **pnaw, NUMA **pnah)
pixaFindDimensions()
PIXA * pixClipRectangles(PIX *pixs, BOXA *boxa)
pixClipRectangles()
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
void pixaDestroy(PIXA **ppixa)
pixaDestroy()
PIXA * pixaCreate(l_int32 n)
pixaCreate()
l_ok pixaRemovePixAndSave(PIXA *pixa, l_int32 index, PIX **ppix, BOX **pbox)
pixaRemovePixAndSave()
l_int32 pixaGetCount(PIXA *pixa)
pixaGetCount()
l_ok pixaAddBox(PIXA *pixa, BOX *box, l_int32 copyflag)
pixaAddBox()
PIX * pixaaGetPix(PIXAA *paa, l_int32 index, l_int32 ipix, l_int32 accessflag)
pixaaGetPix()
PIXA * pixaaGetPixa(PIXAA *paa, l_int32 index, l_int32 accesstype)
pixaaGetPixa()
PIX * pixaGetPix(PIXA *pixa, l_int32 index, l_int32 accesstype)
pixaGetPix()
l_ok pixRemoveWithIndicator(PIX *pixs, PIXA *pixa, NUMA *na)
pixRemoveWithIndicator()
PIX * pixaDisplayTiledInRows(PIXA *pixa, l_int32 outdepth, l_int32 maxwidth, l_float32 scalefactor, l_int32 background, l_int32 spacing, l_int32 border)
pixaDisplayTiledInRows()
PIX * pixaDisplayTiledInColumns(PIXA *pixas, l_int32 nx, l_float32 scalefactor, l_int32 spacing, l_int32 border)
pixaDisplayTiledInColumns()
PIX * pixConvertTo1(PIX *pixs, l_int32 threshold)
pixConvertTo1()
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
PIX * pixConvertTo32(PIX *pixs)
pixConvertTo32()
PTA * ptaaGetPta(PTAA *ptaa, l_int32 index, l_int32 accessflag)
ptaaGetPta()
l_ok ptaGetIPt(PTA *pta, l_int32 index, l_int32 *px, l_int32 *py)
ptaGetIPt()
l_ok ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
ptaGetPt()
void ptaDestroy(PTA **ppta)
ptaDestroy()
@ L_USE_AVERAGE_TEMPLATES
l_int32 recogGetClassString(L_RECOG *recog, l_int32 index, char **pcharstr)
recogGetClassString()
BOXA * recogDecode(L_RECOG *recog, PIX *pixs, l_int32 nlevels, PIX **ppixdb)
recogDecode()
PIXA * showExtractNumbers(PIX *pixs, SARRAY *sa, BOXAA *baa, NUMAA *naa, PIX **ppixdb)
showExtractNumbers()
SARRAY * recogExtractNumbers(L_RECOG *recog, BOXA *boxas, l_float32 scorethresh, l_int32 spacethresh, BOXAA **pbaa, NUMAA **pnaa)
recogExtractNumbers()
l_ok recogCorrelationBestChar(L_RECOG *recog, PIX *pixs, BOX **pbox, l_float32 *pscore, l_int32 *pindex, char **pcharstr, PIX **ppixdb)
recogCorrelationBestChar()
void rchaDestroy(L_RCHA **prcha)
rchaDestroy()
l_ok rchExtract(L_RCH *rch, l_int32 *pindex, l_float32 *pscore, char **ptext, l_int32 *psample, l_int32 *pxloc, l_int32 *pyloc, l_int32 *pwidth)
rchExtract()
static l_int32 recogSplittingFilter(L_RECOG *recog, PIX *pixs, l_int32 min, l_float32 minaf, l_int32 *premove, l_int32 debug)
recogSplittingFilter()
static void l_showIndicatorSplitValues(NUMA *na1, NUMA *na2, NUMA *na3, NUMA *na4, NUMA *na5, NUMA *na6)
l_showIndicatorSplitValues()
static l_int32 transferRchToRcha(L_RCH *rch, L_RCHA *rcha)
transferRchToRcha()
static l_int32 pixCorrelationBestShift(PIX *pix1, PIX *pix2, NUMA *nasum1, NUMA *namoment1, l_int32 area2, l_int32 ycent2, l_int32 maxyshift, l_int32 *tab8, l_int32 *pdelx, l_int32 *pdely, l_float32 *pscore, l_int32 debugflag)
pixCorrelationBestShift()
void rchDestroy(L_RCH **prch)
rchDestroy()
l_ok recogIdentifyPixa(L_RECOG *recog, PIXA *pixa, PIX **ppixdb)
recogIdentifyPixa()
l_ok recogIdentifyPix(L_RECOG *recog, PIX *pixs, PIX **ppixdb)
recogIdentifyPix()
static L_RCHA * rchaCreate()
rchaCreate()
l_ok recogCorrelationBestRow(L_RECOG *recog, PIX *pixs, BOXA **pboxa, NUMA **pnascore, NUMA **pnaindex, SARRAY **psachar, l_int32 debug)
recogCorrelationBestRow()
l_ok recogSkipIdentify(L_RECOG *recog)
recogSkipIdentify()
l_ok recogIdentifyMultiple(L_RECOG *recog, PIX *pixs, l_int32 minh, l_int32 skipsplit, BOXA **pboxa, PIXA **ppixa, PIX **ppixdb, l_int32 debugsplit)
recogIdentifyMultiple()
static PIX * recogPreSplittingFilter(L_RECOG *recog, PIX *pixs, l_int32 minh, l_float32 minaf, l_int32 debug)
recogPreSplittingFilter()
l_ok recogSplitIntoCharacters(L_RECOG *recog, PIX *pixs, l_int32 minh, l_int32 skipsplit, BOXA **pboxa, PIXA **ppixa, l_int32 debug)
recogSplitIntoCharacters()
l_ok rchaExtract(L_RCHA *rcha, NUMA **pnaindex, NUMA **pnascore, SARRAY **psatext, NUMA **pnasample, NUMA **pnaxloc, NUMA **pnayloc, NUMA **pnawidth)
rchaExtract()
static L_RCH * rchCreate(l_int32 index, l_float32 score, char *text, l_int32 sample, l_int32 xloc, l_int32 yloc, l_int32 width)
rchCreate()
PIX * recogProcessToIdentify(L_RECOG *recog, PIX *pixs, l_int32 pad)
recogProcessToIdentify()
PIX * recogShowMatch(L_RECOG *recog, PIX *pix1, PIX *pix2, BOX *box, l_int32 index, l_float32 score)
recogShowMatch()
PIX * recogModifyTemplate(L_RECOG *recog, PIX *pixs)
recogModifyTemplate()
l_int32 recogAverageSamples(L_RECOG **precog, l_int32 debug)
recogAverageSamples()
l_ok pixRasterop(PIX *pixd, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, PIX *pixs, l_int32 sx, l_int32 sy)
pixRasterop()
SARRAY * sarrayCreate(l_int32 n)
sarrayCreate()
char * sarrayGetString(SARRAY *sa, l_int32 index, l_int32 copyflag)
sarrayGetString()
SARRAY * sarrayClone(SARRAY *sa)
sarrayClone()
l_int32 sarrayGetCount(SARRAY *sa)
sarrayGetCount()
void sarrayDestroy(SARRAY **psa)
sarrayDestroy()
l_ok sarrayAddString(SARRAY *sa, const char *string, l_int32 copyflag)
sarrayAddString()
char * sarrayToString(SARRAY *sa, l_int32 addnlflag)
sarrayToString()
SARRAY * sarraySortByIndex(SARRAY *sain, NUMA *naindex)
sarraySortByIndex()
PIX * pixExpandReplicate(PIX *pixs, l_int32 factor)
pixExpandReplicate()
struct Pixa * pixadb_split
PIX * pixAddTextlines(PIX *pixs, L_BMF *bmf, const char *textstr, l_uint32 val, l_int32 location)
pixAddTextlines()
void lept_stderr(const char *fmt,...)
lept_stderr()
char * stringNew(const char *src)
stringNew()
l_ok stringJoinIP(char **psrc1, const char *src2)
stringJoinIP()
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()