93 #include "allheaders.h" 97 #define SPLIT_WITH_DID 1 100 static const l_int32 LeftRightPadding = 32;
103 static const l_float32 MinFillFactor = 0.10;
104 static const l_int32 DefaultMinHeight = 15;
105 static const l_int32 MinOverlap1 = 6;
106 static const l_int32 MinOverlap2 = 6;
107 static const l_int32 MinHeightPass1 = 5;
111 NUMA *namoment1, l_int32 area2,
112 l_int32 ycent2, l_int32 maxyshift,
113 l_int32 *tab8, l_int32 *pdelx,
114 l_int32 *pdely, l_float32 *pscore,
116 static L_RCH *
rchCreate(l_int32 index, l_float32 score,
char *text,
117 l_int32 sample, l_int32 xloc, l_int32 yloc,
122 l_float32 minaf, l_int32 debug);
124 l_float32 minaf, l_int32 *premove,
172 PROCNAME(
"recogIdentifyMultiple");
174 if (pboxa) *pboxa = NULL;
175 if (ppixa) *ppixa = NULL;
176 if (ppixdb) *ppixdb = NULL;
178 return ERROR_INT(
"recog not defined", procName, 2);
180 return ERROR_INT(
"training not finished", procName, 2);
182 return ERROR_INT(
"pixs not defined", procName, 2);
185 if (pixGetDepth(
pixs) > 1)
197 L_WARNING(
"nothing found\n", procName);
254 static l_int32 ind = 0;
256 l_int32 i, xoff, yoff, empty, maxw, bw, ncomp, scaling;
258 BOXA *boxa1, *boxa2, *boxa3, *boxa4, *boxad;
260 PIX *pix, *pix1, *pix2, *pix3;
263 PROCNAME(
"recogSplitIntoCharacters");
267 if (pboxa) *pboxa = NULL;
268 if (ppixa) *ppixa = NULL;
269 if (!pboxa || !ppixa)
270 return ERROR_INT(
"&boxa and &pixa not defined", procName, 1);
272 return ERROR_INT(
"recog not defined", procName, 1);
274 return ERROR_INT(
"training not finished", procName, 1);
275 if (!
pixs || pixGetDepth(
pixs) != 1)
276 return ERROR_INT(
"pixs not defined or not 1 bpp", procName, 1);
277 if (minh <= 0) minh = DefaultMinHeight;
295 L_WARNING(
"all components removed\n", procName);
302 scaling = (recog->
scalew > 0 || recog->
scaleh > 0) ? TRUE : FALSE;
304 for (i = 0; i < ncomp; i++) {
309 if (bw <= maxw || scaling || skipsplit) {
332 L_ERROR(
"boxa3 not found for component %d\n", procName, i);
344 snprintf(buf,
sizeof(buf),
"/tmp/lept/recog/decode-%d.png", ind++);
345 pixWrite(buf, pix3, IFF_PNG);
355 baa =
boxaSort2d(boxa2, NULL, MinOverlap1, MinOverlap2, MinHeightPass1);
410 l_int32 index,
remove, w, h, bx, bw, bxc, bwc, w1, w2, w3;
412 BOX *box, *boxc, *boxtrans, *boxl, *boxr, *boxlt, *boxrt;
414 NUMA *nascoret, *naindext, *nasort;
415 PIX *pixb, *pixc, *pixl, *pixr, *pixdb, *pixd;
416 PIXA *pixar, *pixadb;
421 PROCNAME(
"recogCorrelationBestRow");
423 if (pnascore) *pnascore = NULL;
424 if (pnaindex) *pnaindex = NULL;
425 if (psachar) *psachar = NULL;
427 return ERROR_INT(
"&boxa not defined", procName, 1);
430 return ERROR_INT(
"recog not defined", procName, 1);
431 if (!
pixs || pixGetDepth(
pixs) != 1)
432 return ERROR_INT(
"pixs not defined or not 1 bpp", procName, 1);
434 return ERROR_INT(
"pixs too narrow", procName, 1);
436 return ERROR_INT(
"training not finished", procName, 1);
460 for (iter = 0; iter < 11; iter++) {
464 L_WARNING(
"more than 10 chars; ending search\n", procName);
475 fprintf(stderr,
"iter = %d, removed = %d\n", iter,
remove);
485 &index, &charstr, &pixdb);
489 &index, &charstr, NULL);
507 fprintf(stderr,
" w1 = %d, w2 = %d, w3 = %d\n", w1, w2, w3);
508 if (w1 < recog->minwidth_u - 4) {
509 if (debug) L_INFO(
"discarding width %d on left\n", procName, w1);
518 if (w3 < recog->minwidth_u - 4) {
519 if (debug) L_INFO(
"discarding width %d on right\n", procName, w3);
521 boxr =
boxCreate(bx + bw - 1, 0, w3 + 1, h);
552 pixDisplay(pixd, 400, 400);
591 l_int32 i, n, w1, h1, w2, area2, ycent2, delx, dely;
592 l_int32 bestdelx, bestdely, bestindex;
593 l_float32 score, bestscore;
599 PROCNAME(
"recogCorrelationBestChar");
601 if (pindex) *pindex = 0;
602 if (pcharstr) *pcharstr = NULL;
603 if (ppixdb) *ppixdb = NULL;
604 if (pbox) *pbox = NULL;
605 if (pscore) *pscore = 0.0;
606 if (!pbox || !pscore)
607 return ERROR_INT(
"&box and &score not both defined", procName, 1);
609 return ERROR_INT(
"recog not defined", procName, 1);
610 if (!
pixs || pixGetDepth(
pixs) != 1)
611 return ERROR_INT(
"pixs not defined or not 1 bpp", procName, 1);
613 return ERROR_INT(
"training not finished", procName, 1);
629 bestindex = bestdelx = bestdely = 0;
630 for (i = 0; i < n; i++) {
632 w2 = pixGetWidth(pix2);
643 "Best match template %d: (x,y) = (%d,%d), score = %5.3f\n",
644 i, delx, dely, score);
647 box =
boxCreate(delx - LeftRightPadding, 0, w2, h1);
648 if (score > bestscore) {
650 bestdelx = delx - LeftRightPadding;
657 fprintf(stderr,
"Component too thin: w1 = %d, w2 = %d\n",
666 if (pindex) *pindex = bestindex;
671 L_INFO(
"Best match: class %d; shifts (%d, %d)\n",
672 procName, bestindex, bestdelx, bestdely);
739 l_int32 w1, w2, h1, h2, i, j, nx, shifty, delx, dely;
740 l_int32 sum, moment, count;
741 l_int32 *tab, *area1, *arraysum, *arraymoment;
742 l_float32 maxscore, score;
745 PIX *pixt, *pixt1, *pixt2;
747 PROCNAME(
"pixCorrelationBestShift");
749 if (pdelx) *pdelx = 0;
750 if (pdely) *pdely = 0;
751 if (pscore) *pscore = 0.0;
752 if (!pix1 || pixGetDepth(pix1) != 1)
753 return ERROR_INT(
"pix1 not defined or not 1 bpp", procName, 1);
754 if (!pix2 || pixGetDepth(pix2) != 1)
755 return ERROR_INT(
"pix2 not defined or not 1 bpp", procName, 1);
756 if (!nasum1 || !namoment1)
757 return ERROR_INT(
"nasum1 and namoment1 not both defined", procName, 1);
758 if (area2 <= 0 || ycent2 <= 0)
759 return ERROR_INT(
"area2 and ycent2 must be > 0", procName, 1);
768 L_INFO(
"skipping match with w1 = %d and w2 = %d\n",
784 area1 = (l_int32 *)LEPT_CALLOC(nx,
sizeof(l_int32));
785 ycent1 = (l_float32 *)LEPT_CALLOC(nx,
sizeof(l_int32));
788 for (i = 0, sum = 0, moment = 0; i < w2; i++) {
790 moment += arraymoment[i];
792 for (i = 0; i < nx - 1; i++) {
794 ycent1[i] = (sum == 0) ? ycent2 : (l_float32)moment / (l_float32)sum;
795 sum += arraysum[w2 + i] - arraysum[i];
796 moment += arraymoment[w2 + i] - arraymoment[i];
799 ycent1[nx - 1] = (sum == 0) ? ycent2 : (l_float32)moment / (l_float32)sum;
812 for (i = 0; i < nx; i++) {
813 shifty = (l_int32)(ycent1[i] - ycent2 + 0.5);
814 for (j = -maxyshift; j <= maxyshift; j++) {
819 score = (l_float32)count * (l_float32)count /
820 ((l_float32)area1[i] * (l_float32)area2);
821 if (score > maxscore) {
837 snprintf(buf,
sizeof(buf),
"/tmp/lept/recog/junkbs_%d.png", debugflag);
838 pixWrite(buf, pixt2, IFF_PNG);
844 if (pdelx) *pdelx = delx;
845 if (pdely) *pdely = dely;
846 if (pscore) *pscore = maxscore;
847 if (!tab8) LEPT_FREE(tab);
851 LEPT_FREE(arraymoment);
884 l_int32 i, n, fail, index, depth;
886 PIX *pix1, *pix2, *pix3;
890 PROCNAME(
"recogIdentifyPixa");
892 if (ppixdb) *ppixdb = NULL;
894 return ERROR_INT(
"recog not defined", procName, 1);
896 return ERROR_INT(
"pixa not defined", procName, 1);
905 for (i = 0; i < n; i++) {
915 if ((rch = recog->
rch) == NULL) {
916 L_ERROR(
"rch not found for char %d\n", procName, i);
921 rchExtract(rch, NULL, NULL, &text, NULL, NULL, NULL, NULL);
925 rchExtract(rch, &index, &score, NULL, NULL, NULL, NULL, NULL);
927 if (i == 0) depth = pixGetDepth(pix3);
977 l_int32 i, j, n, bestindex, bestsample, area1, area2;
978 l_int32 shiftx, shifty, bestdelx, bestdely, bestwidth, maxyshift;
979 l_float32 x1, y1, x2, y2, delx, dely, score, maxscore;
981 PIX *pix0, *pix1, *pix2;
985 PROCNAME(
"recogIdentifyPix");
987 if (ppixdb) *ppixdb = NULL;
989 return ERROR_INT(
"recog not defined", procName, 1);
990 if (!
pixs || pixGetDepth(
pixs) != 1)
991 return ERROR_INT(
"pixs not defined or not 1 bpp", procName, 1);
997 return ERROR_INT(
"averaging failed", procName, 1);
1002 return ERROR_INT(
"no fg pixels in pix0", procName, 1);
1008 return ERROR_INT(
"no fg pixels in pix1", procName, 1);
1014 bestindex = bestsample = bestdelx = bestdely = bestwidth = 0;
1018 for (i = 0; i < recog->
setsize; i++) {
1020 if (area2 == 0)
continue;
1025 for (shifty = -maxyshift; shifty <= maxyshift; shifty++) {
1026 for (shiftx = -maxyshift; shiftx <= maxyshift; shiftx++) {
1027 pixCorrelationScoreSimple(pix1, pix2, area1, area2,
1028 delx + shiftx, dely + shifty,
1029 5, 5, recog->
sumtab, &score);
1030 if (score > maxscore) {
1032 bestdelx = delx + shiftx;
1033 bestdely = dely + shifty;
1041 for (i = 0; i < recog->
setsize; i++) {
1050 for (j = 0; j < n; j++) {
1056 for (shifty = -maxyshift; shifty <= maxyshift; shifty++) {
1057 for (shiftx = -maxyshift; shiftx <= maxyshift; shiftx++) {
1058 pixCorrelationScoreSimple(pix1, pix2, area1, area2,
1059 delx + shiftx, dely + shifty,
1060 5, 5, recog->
sumtab, &score);
1061 if (score > maxscore) {
1064 bestdelx = delx + shiftx;
1065 bestdely = dely + shifty;
1067 bestwidth = pixGetWidth(pix2);
1082 recog->
rch =
rchCreate(bestindex, maxscore, text, bestsample,
1083 bestdelx, bestdely, bestwidth);
1087 L_INFO(
"Best match: str %s; class %d; sh (%d, %d); score %5.3f\n",
1088 procName, text, bestindex, bestdelx, bestdely, maxscore);
1091 L_INFO(
"Best match: str %s; sample %d in class %d; score %5.3f\n",
1092 procName, text, bestsample, bestindex, maxscore);
1093 if (maxyshift > 0 && (L_ABS(bestdelx) > 0 || L_ABS(bestdely) > 0)) {
1094 L_INFO(
" Best shift: (%d, %d)\n",
1095 procName, bestdelx, bestdely);
1123 PROCNAME(
"recogSkipIdentify");
1126 return ERROR_INT(
"recog not defined", procName, 1);
1173 PROCNAME(
"rchaDestroy");
1175 if (prcha == NULL) {
1176 L_WARNING(
"&rcha is null!\n", procName);
1179 if ((rcha = *prcha) == NULL)
1225 rch = (
L_RCH *)LEPT_CALLOC(1,
sizeof(
L_RCH));
1247 PROCNAME(
"rchDestroy");
1250 L_WARNING(
"&rch is null!\n", procName);
1253 if ((rch = *prch) == NULL)
1255 LEPT_FREE(rch->
text);
1291 PROCNAME(
"rchaExtract");
1293 if (pnaindex) *pnaindex = NULL;
1294 if (pnascore) *pnascore = NULL;
1295 if (psatext) *psatext = NULL;
1296 if (pnasample) *pnasample = NULL;
1297 if (pnaxloc) *pnaxloc = NULL;
1298 if (pnayloc) *pnayloc = NULL;
1299 if (pnawidth) *pnawidth = NULL;
1301 return ERROR_INT(
"rcha not defined", procName, 1);
1337 PROCNAME(
"rchExtract");
1339 if (pindex) *pindex = 0;
1340 if (pscore) *pscore = 0.0;
1341 if (ptext) *ptext = NULL;
1342 if (psample) *psample = 0;
1343 if (pxloc) *pxloc = 0;
1344 if (pyloc) *pyloc = 0;
1345 if (pwidth) *pwidth = 0;
1347 return ERROR_INT(
"rch not defined", procName, 1);
1349 if (pindex) *pindex = rch->
index;
1350 if (pscore) *pscore = rch->
score;
1352 if (psample) *psample = rch->
sample;
1353 if (pxloc) *pxloc = rch->
xloc;
1354 if (pyloc) *pyloc = rch->
yloc;
1355 if (pwidth) *pwidth = rch->
width;
1378 PROCNAME(
"transferRchToRcha");
1381 return ERROR_INT(
"rch not defined", procName, 1);
1383 return ERROR_INT(
"rcha not defined", procName, 1);
1421 PIX *pix1, *pix2, *pixd;
1423 PROCNAME(
"recogProcessToIdentify");
1426 return (
PIX *)ERROR_PTR(
"recog not defined", procName, NULL);
1428 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
1430 if (pixGetDepth(
pixs) != 1)
1441 return (
PIX *)ERROR_PTR(
"no foreground pixels", procName, NULL);
1466 l_int32 scaling, minsplitw, maxsplith, maxasp;
1468 NUMA *naw, *nah, *na1, *na1c, *na2, *na3, *na4, *na5, *na6, *na7;
1472 PROCNAME(
"recogPreSplittingFilter");
1475 return (
PIX *)ERROR_PTR(
"recog not defined", procName, NULL);
1477 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
1481 scaling = (recog->
scalew > 0 || recog->
scaleh > 0) ? TRUE : FALSE;
1482 minsplitw = (scaling) ? 1 : recog->
min_splitw - 3;
1483 maxsplith = (scaling) ? 150 : recog->
max_splith;
1545 l_float32 aspratio, fract;
1547 PROCNAME(
"recogSplittingFilter");
1550 return ERROR_INT(
"&remove not defined", procName, 1);
1553 return ERROR_INT(
"recog not defined", procName, 1);
1555 return ERROR_INT(
"pixs not defined", procName, 1);
1556 if (minh <= 0) minh = DefaultMinHeight;
1563 if (w < recog->min_splitw) {
1564 if (debug) L_INFO(
"w = %d < %d\n", procName, w, recog->
min_splitw);
1569 if (debug) L_INFO(
"h = %d < %d\n", procName, h, minh);
1573 aspratio = (l_float32)w / (l_float32)h;
1575 if (debug) L_INFO(
"w/h = %5.3f too large\n", procName, aspratio);
1580 if (fract < minaf) {
1581 if (debug) L_INFO(
"area fill fract %5.3f < %5.3f\n",
1582 procName, fract, minaf);
1631 l_float32 scorethresh,
1632 l_int32 spacethresh,
1637 l_int32 i, n, x1, x2, h_sep, v_sep;
1644 SARRAY *satext, *sa, *saout;
1646 PROCNAME(
"recogExtractNumbers");
1648 if (pbaa) *pbaa = NULL;
1649 if (pnaa) *pnaa = NULL;
1650 if (!recog || !recog->
rcha)
1651 return (
SARRAY *)ERROR_PTR(
"recog and rcha not both defined",
1654 return (
SARRAY *)ERROR_PTR(
"boxas not defined", procName, NULL);
1656 if (spacethresh < 0)
1662 return (
SARRAY *)ERROR_PTR(
"nascore and satext not both returned",
1671 for (i = 0; i < n; i++) {
1674 if (prebox == NULL) {
1675 if (score < scorethresh) {
1692 if (x1 < x2 && h_sep <= spacethresh &&
1693 v_sep < 0 && score >= scorethresh) {
1705 if (score >= scorethresh) {
1728 L_INFO(
"saout has no identified text\n", procName);
1769 char *textstr, *scorestr;
1770 l_int32 i, j, n, nchar, len;
1776 PIX *pix1, *pix2, *pix3, *pix4;
1779 PROCNAME(
"showExtractNumbers");
1781 if (ppixdb) *ppixdb = NULL;
1783 return (
PIXA *)ERROR_PTR(
"pixs not defined", procName, NULL);
1785 return (
PIXA *)ERROR_PTR(
"sa not defined", procName, NULL);
1787 return (
PIXA *)ERROR_PTR(
"baa not defined", procName, NULL);
1789 return (
PIXA *)ERROR_PTR(
"naa not defined", procName, NULL);
1795 for (i = 0; i < n; i++) {
1803 len = strlen(textstr) + 1;
1809 for (j = 0; j < nchar; j++) {
1811 snprintf(buf,
sizeof(buf),
"%d", (l_int32)(100 * score));
1815 snprintf(buf,
sizeof(buf),
"%s: %s\n", textstr, scorestr);
1825 LEPT_FREE(scorestr);
1859 fprintf(stderr,
"================================================\n");
1860 fprintf(stderr,
"lt minw: ");
1861 for (i = 0; i < n; i++)
1862 fprintf(stderr,
"%4d ", (l_int32)na1->
array[i]);
1863 fprintf(stderr,
"\nlt minh: ");
1864 for (i = 0; i < n; i++)
1865 fprintf(stderr,
"%4d ", (l_int32)na2->
array[i]);
1866 fprintf(stderr,
"\ngt maxh: ");
1867 for (i = 0; i < n; i++)
1868 fprintf(stderr,
"%4d ", (l_int32)na3->
array[i]);
1869 fprintf(stderr,
"\ngt maxasp: ");
1870 for (i = 0; i < n; i++)
1871 fprintf(stderr,
"%4d ", (l_int32)na4->
array[i]);
1872 fprintf(stderr,
"\nlt minaf: ");
1873 for (i = 0; i < n; i++)
1874 fprintf(stderr,
"%4d ", (l_int32)na5->
array[i]);
1875 fprintf(stderr,
"\n------------------------------------------------");
1876 fprintf(stderr,
"\nresult: ");
1877 for (i = 0; i < n; i++)
1878 fprintf(stderr,
"%4d ", (l_int32)na6->
array[i]);
1879 fprintf(stderr,
"\n================================================\n");
void bmfDestroy(L_BMF **pbmf)
bmfDestroy()
PIX * pixConvertTo1(PIX *pixs, l_int32 threshold)
pixConvertTo1()
l_ok rchaExtract(L_RCHA *rcha, NUMA **pnaindex, NUMA **pnascore, SARRAY **psatext, NUMA **pnasample, NUMA **pnaxloc, NUMA **pnayloc, NUMA **pnawidth)
rchaExtract()
void rchaDestroy(L_RCHA **prcha)
rchaDestroy()
l_ok numaGetFValue(NUMA *na, l_int32 index, l_float32 *pval)
numaGetFValue()
NUMA * pixCountPixelsByColumn(PIX *pix)
pixCountPixelsByColumn()
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()
char * sarrayToString(SARRAY *sa, l_int32 addnlflag)
sarrayToString()
l_ok boxaJoin(BOXA *boxad, BOXA *boxas, l_int32 istart, l_int32 iend)
boxaJoin()
l_ok pixCentroid(PIX *pix, l_int32 *centtab, l_int32 *sumtab, l_float32 *pxave, l_float32 *pyave)
pixCentroid()
l_ok recogSkipIdentify(L_RECOG *recog)
recogSkipIdentify()
NUMA * pixaFindAreaFraction(PIXA *pixa)
pixaFindAreaFraction()
BOXA * boxaSort(BOXA *boxas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex)
boxaSort()
PIX * pixConvertTo32(PIX *pixs)
pixConvertTo32()
l_ok recogSplitIntoCharacters(L_RECOG *recog, PIX *pixs, l_int32 minh, l_int32 skipsplit, BOXA **pboxa, PIXA **ppixa, l_int32 debug)
recogSplitIntoCharacters()
NUMA * numaSortByIndex(NUMA *nas, NUMA *naindex)
numaSortByIndex()
l_ok numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
PIXA * pixaCreate(l_int32 n)
pixaCreate()
l_ok pixaRemovePixAndSave(PIXA *pixa, l_int32 index, PIX **ppix, BOX **pbox)
pixaRemovePixAndSave()
char * stringNew(const char *src)
stringNew()
struct Pixa * pixadb_split
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()
PIXA * pixaaGetPixa(PIXAA *paa, l_int32 index, l_int32 accesstype)
pixaaGetPixa()
l_int32 recogGetClassString(L_RECOG *recog, l_int32 index, char **pcharstr)
recogGetClassString()
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
static l_int32 recogSplittingFilter(L_RECOG *recog, PIX *pixs, l_int32 min, l_float32 minaf, l_int32 *premove, l_int32 debug)
recogSplittingFilter()
void rchDestroy(L_RCH **prch)
rchDestroy()
static L_RCHA * rchaCreate()
rchaCreate()
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
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()
SARRAY * sarrayCreate(l_int32 n)
sarrayCreate()
BOXA * recogDecode(L_RECOG *recog, PIX *pixs, l_int32 nlevels, PIX **ppixdb)
recogDecode()
NUMA * pixaFindWidthHeightRatio(PIXA *pixa)
pixaFindWidthHeightRatio()
NUMA * numaCreate(l_int32 n)
numaCreate()
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
PIX * pixAddBlackOrWhiteBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_int32 op)
pixAddBlackOrWhiteBorder()
BOX * boxTransform(BOX *box, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley)
boxTransform()
PIX * pixThresholdToBinary(PIX *pixs, l_int32 thresh)
pixThresholdToBinary()
BOXA * boxaHandleOverlaps(BOXA *boxas, l_int32 op, l_int32 range, l_float32 min_overlap, l_float32 max_ratio, NUMA **pnamap)
boxaHandleOverlaps()
SARRAY * recogExtractNumbers(L_RECOG *recog, BOXA *boxas, l_float32 scorethresh, l_int32 spacethresh, BOXAA **pbaa, NUMAA **pnaa)
recogExtractNumbers()
NUMAA * numaaCreate(l_int32 n)
numaaCreate()
PIX * pixClipRectangle(PIX *pixs, BOX *box, BOX **pboxc)
pixClipRectangle()
l_ok recogCorrelationBestChar(L_RECOG *recog, PIX *pixs, BOX **pbox, l_float32 *pscore, l_int32 *pindex, char **pcharstr, PIX **ppixdb)
recogCorrelationBestChar()
PIX * pixaDisplayTiledInColumns(PIXA *pixas, l_int32 nx, l_float32 scalefactor, l_int32 spacing, l_int32 border)
pixaDisplayTiledInColumns()
static l_int32 transferRchToRcha(L_RCH *rch, L_RCHA *rcha)
transferRchToRcha()
void numaaDestroy(NUMAA **pnaa)
numaaDestroy()
PIX * pixaaGetPix(PIXAA *paa, l_int32 index, l_int32 ipix, l_int32 accessflag)
pixaaGetPix()
l_ok fpixSetPixel(FPIX *fpix, l_int32 x, l_int32 y, l_float32 val)
fpixSetPixel()
l_ok pixSetText(PIX *pix, const char *textstring)
pixSetText()
l_ok pixClipToForeground(PIX *pixs, PIX **ppixd, BOX **pbox)
pixClipToForeground()
l_ok boxSeparationDistance(BOX *box1, BOX *box2, l_int32 *ph_sep, l_int32 *pv_sep)
boxSeparationDistance()
PIX * fpixDisplayMaxDynamicRange(FPIX *fpixs)
fpixDisplayMaxDynamicRange()
l_int32 * numaGetIArray(NUMA *na)
numaGetIArray()
l_ok pixaFindDimensions(PIXA *pixa, NUMA **pnaw, NUMA **pnah)
pixaFindDimensions()
l_ok boxaaAddBoxa(BOXAA *baa, BOXA *ba, l_int32 copyflag)
boxaaAddBoxa()
BOXA * pixConnComp(PIX *pixs, PIXA **ppixa, l_int32 connectivity)
pixConnComp()
NUMA * numaaGetNuma(NUMAA *naa, l_int32 index, l_int32 accessflag)
numaaGetNuma()
PTA * ptaaGetPta(PTAA *ptaa, l_int32 index, l_int32 accessflag)
ptaaGetPta()
static void l_showIndicatorSplitValues(NUMA *na1, NUMA *na2, NUMA *na3, NUMA *na4, NUMA *na5, NUMA *na6)
l_showIndicatorSplitValues()
l_ok numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
SARRAY * sarraySortByIndex(SARRAY *sain, NUMA *naindex)
sarraySortByIndex()
void boxaaDestroy(BOXAA **pbaa)
boxaaDestroy()
l_ok recogIdentifyPix(L_RECOG *recog, PIX *pixs, PIX **ppixdb)
recogIdentifyPix()
BOXA * boxaTransform(BOXA *boxas, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley)
boxaTransform()
l_int32 numaGetCount(NUMA *na)
numaGetCount()
l_ok sarrayAddString(SARRAY *sa, const char *string, l_int32 copyflag)
sarrayAddString()
l_ok pixClearAll(PIX *pix)
pixClearAll()
PIX * pixaDisplayTiledInRows(PIXA *pixa, l_int32 outdepth, l_int32 maxwidth, l_float32 scalefactor, l_int32 background, l_int32 spacing, l_int32 border)
pixaDisplayTiledInRows()
PIX * pixMorphSequence(PIX *pixs, const char *sequence, l_int32 dispsep)
pixMorphSequence()
l_ok stringJoinIP(char **psrc1, const char *src2)
stringJoinIP()
l_ok pixCountPixels(PIX *pixs, l_int32 *pcount, l_int32 *tab8)
pixCountPixels()
l_ok boxaAddBox(BOXA *boxa, BOX *box, l_int32 copyflag)
boxaAddBox()
l_ok ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
ptaGetPt()
l_int32 * makePixelSumTab8(void)
makePixelSumTab8()
PIXA * pixClipRectangles(PIX *pixs, BOXA *boxa)
pixClipRectangles()
l_ok recogCorrelationBestRow(L_RECOG *recog, PIX *pixs, BOXA **pboxa, NUMA **pnascore, NUMA **pnaindex, SARRAY **psachar, l_int32 debug)
recogCorrelationBestRow()
BOX * boxAdjustSides(BOX *boxd, BOX *boxs, l_int32 delleft, l_int32 delright, l_int32 deltop, l_int32 delbot)
boxAdjustSides()
l_ok pixRemoveWithIndicator(PIX *pixs, PIXA *pixa, NUMA *na)
pixRemoveWithIndicator()
NUMA * numaMakeThresholdIndicator(NUMA *nas, l_float32 thresh, l_int32 type)
numaMakeThresholdIndicator()
char * sarrayGetString(SARRAY *sa, l_int32 index, l_int32 copyflag)
sarrayGetString()
PIX * pixClone(PIX *pixs)
pixClone()
void pixDestroy(PIX **ppix)
pixDestroy()
BOX * boxaGetBox(BOXA *boxa, l_int32 index, l_int32 accessflag)
boxaGetBox()
PIX * recogProcessToIdentify(L_RECOG *recog, PIX *pixs, l_int32 pad)
recogProcessToIdentify()
static PIX * recogPreSplittingFilter(L_RECOG *recog, PIX *pixs, l_int32 minh, l_float32 minaf, l_int32 debug)
recogPreSplittingFilter()
NUMA * pixGetMomentByColumn(PIX *pix, l_int32 order)
pixGetMomentByColumn()
l_int32 recogAverageSamples(L_RECOG **precog, l_int32 debug)
recogAverageSamples()
NUMA * numaCopy(NUMA *na)
numaCopy()
SARRAY * sarrayClone(SARRAY *sa)
sarrayClone()
l_ok boxaGetExtent(BOXA *boxa, l_int32 *pw, l_int32 *ph, BOX **pbox)
boxaGetExtent()
void numaDestroy(NUMA **pna)
numaDestroy()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
PIX * recogShowMatch(L_RECOG *recog, PIX *pix1, PIX *pix2, BOX *box, l_int32 index, l_float32 score)
recogShowMatch()
BOXAA * boxaaCreate(l_int32 n)
boxaaCreate()
l_int32 sarrayGetCount(SARRAY *sa)
sarrayGetCount()
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()
PIX * pixExpandReplicate(PIX *pixs, l_int32 factor)
pixExpandReplicate()
FPIX * fpixCreate(l_int32 width, l_int32 height)
fpixCreate()
l_ok pixRenderBoxaArb(PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderBoxaArb()
PIX * pixaGetPix(PIXA *pixa, l_int32 index, l_int32 accesstype)
pixaGetPix()
l_ok pixRenderBoxArb(PIX *pix, BOX *box, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderBoxArb()
l_ok recogIdentifyPixa(L_RECOG *recog, PIXA *pixa, PIX **ppixdb)
recogIdentifyPixa()
NUMA * numaLogicalOp(NUMA *nad, NUMA *na1, NUMA *na2, l_int32 op)
numaLogicalOp()
void ptaDestroy(PTA **ppta)
ptaDestroy()
l_ok pixZero(PIX *pix, l_int32 *pempty)
pixZero()
BOXA * boxaCreate(l_int32 n)
boxaCreate()
PIX * pixCopy(PIX *pixd, PIX *pixs)
pixCopy()
PIX * recogModifyTemplate(L_RECOG *recog, PIX *pixs)
recogModifyTemplate()
void boxDestroy(BOX **pbox)
boxDestroy()
BOXAA * boxaSort2d(BOXA *boxas, NUMAA **pnaad, l_int32 delta1, l_int32 delta2, l_int32 minh1)
boxaSort2d()
NUMA * numaClone(NUMA *na)
numaClone()
PIX * pixAddTextlines(PIX *pixs, L_BMF *bmf, const char *textstr, l_uint32 val, l_int32 location)
pixAddTextlines()
l_int32 boxaGetCount(BOXA *boxa)
boxaGetCount()
l_ok recogIdentifyMultiple(L_RECOG *recog, PIX *pixs, l_int32 minh, l_int32 skipsplit, BOXA **pboxa, PIXA **ppixa, PIX **ppixdb, l_int32 debugsplit)
recogIdentifyMultiple()
PIXA * showExtractNumbers(PIX *pixs, SARRAY *sa, BOXAA *baa, NUMAA *naa, PIX **ppixdb)
showExtractNumbers()
l_ok pixFindAreaFraction(PIX *pixs, l_int32 *tab, l_float32 *pfract)
pixFindAreaFraction()
l_ok ptaGetIPt(PTA *pta, l_int32 index, l_int32 *px, l_int32 *py)
ptaGetIPt()
l_ok pixTestClipToForeground(PIX *pixs, l_int32 *pcanclip)
pixTestClipToForeground()
BOXA * boxaaFlattenToBoxa(BOXAA *baa, NUMA **pnaindex, l_int32 copyflag)
boxaaFlattenToBoxa()
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 fpixDestroy(FPIX **pfpix)
fpixDestroy()
l_ok pixaAddBox(PIXA *pixa, BOX *box, l_int32 copyflag)
pixaAddBox()
l_ok boxGetGeometry(BOX *box, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxGetGeometry()
void pixaDestroy(PIXA **ppixa)
pixaDestroy()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
l_int32 pixaGetCount(PIXA *pixa)
pixaGetCount()
l_ok numaaAddNuma(NUMAA *naa, NUMA *na, l_int32 copyflag)
numaaAddNuma()
PIX * pixAddBorderGeneral(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_uint32 val)
pixAddBorderGeneral()
BOXA * boxaaGetBoxa(BOXAA *baa, l_int32 index, l_int32 accessflag)
boxaaGetBoxa()
void sarrayDestroy(SARRAY **psa)
sarrayDestroy()
L_BMF * bmfCreate(const char *dir, l_int32 fontsize)
bmfCreate()