63 #include <config_auto.h>
67 #include "allheaders.h"
73 PTA **pptal2,
PTA **pptar2);
76 l_int32 *pntop, l_int32 *pnbot,
77 l_int32 *pytop, l_int32 *pybot);
81 l_float32 *pc, l_float32 *pmederr);
88 #define DEBUG_TEXTLINE_CENTERS 0
89 #define DEBUG_SHORT_LINES 0
91 #define DEBUG_TEXTLINE_CENTERS 0
92 #define DEBUG_SHORT_LINES 0
96 static const l_float32 MinRatioLinesToHeight = 0.45;
97 static const l_int32 MinLinesForHoriz1 = 10;
98 static const l_int32 MinLinesForHoriz2 = 3;
99 static const l_float32 AllowedWidthFract = 0.05;
157 const char *debugfile)
159 l_int32 linecount, ntop, nbot, ytop, ybot, ret;
160 PIX *pixs, *pix1, *pix2, *pix3;
165 return ERROR_INT(
"dew not defined", __func__, 1);
167 dew->
debug = (debugfile) ? 1 : 0;
173 pixDisplayWithTitle(pixs, 0, 0,
"pixs", 1);
174 pixWriteDebug(
"/tmp/lept/dewmod/0010.png", pixs, IFF_PNG);
180 L_WARNING(
"textline centers not found; model not built\n", __func__);
188 pixWriteDebug(
"/tmp/lept/dewmod/0020.png", pix3, IFF_PNG);
198 debugfile || DEBUG_SHORT_LINES);
204 pixWriteDebug(
"/tmp/lept/dewmod/0030.png", pix3, IFF_PNG);
214 if (linecount < dew->minlines) {
216 L_WARNING(
"linecount %d < min req'd number of lines (%d) for model\n",
217 __func__, linecount, dew->
minlines);
224 &ntop, &nbot, &ytop, &ybot) == FALSE) {
226 L_WARNING(
"invalid line coverage: ntop = %d, nbot = %d;"
227 " spanning [%d ... %d] in height %d\n", __func__,
228 ntop, nbot, ytop, ybot, pixGetHeight(pixs));
236 L_WARNING(
"vertical disparity not built\n", __func__);
247 L_INFO(
"hsuccess = 1\n", __func__);
253 pixWriteDebug(
"/tmp/lept/dewmod/0060.png", pix1, IFF_PNG);
254 pixDisplay(pix1, 1000, 0);
258 pixWriteDebug(
"/tmp/lept/dewmod/0070.png", pix1, IFF_PNG);
259 pixDisplay(pix1, 1000, 0);
263 "Dewarp Build Model", debugfile);
305 l_int32 i, j, nlines, npts, nx, ny, sampling;
306 l_float32 c0, c1, c2, x, y, midy, val, medval, meddev, minval, maxval;
308 NUMA *nax, *nafit, *nacurve0, *nacurve1, *nacurves;
309 NUMA *namidy, *namidys, *namidysi;
310 PIX *pix1, *pix2, *pixcirc, *pixdb;
311 PTA *pta, *ptad, *ptacirc;
312 PTAA *ptaa0, *ptaa1, *ptaa2, *ptaa3, *ptaa4, *ptaa5, *ptaat;
316 return ERROR_INT(
"dew not defined", __func__, 1);
319 return ERROR_INT(
"ptaa not defined", __func__, 1);
321 if (dew->
debug) L_INFO(
"finding vertical disparity\n", __func__);
330 nx = (rotflag) ? dew->
ny : dew->
nx;
331 ny = (rotflag) ? dew->
nx : dew->
ny;
337 for (i = 0; i < nlines; i++) {
342 for (j = 0; j < nx; j++) {
355 for (i = 0; i < nlines; i++) {
369 pixWriteDebug(
"/tmp/lept/dewmod/0041.png", pix2, IFF_PNG);
383 L_INFO(
"\nPage %d\n", __func__, dew->
pageno);
384 L_INFO(
"Pass 1: Curvature: medval = %f, meddev = %f\n",
385 __func__, medval, meddev);
388 for (i = 0; i < nlines; i++) {
390 if (L_ABS(val - medval) > 7.0 * meddev)
404 L_INFO(
"Pass 2: Min/max curvature = (%d, %d)\n", __func__,
410 for (i = 0; i < nlines; i++) {
413 ptaGetPt(pta, npts / 2, NULL, &midy);
441 pixWriteDebug(
"/tmp/lept/dewmod/0042.png", pix2, IFF_PNG);
442 pixDisplay(pix2, 0, 0);
455 for (i = 0; i < nlines; i++) {
459 for (j = 0; j < nx; j++) {
478 for (j = 0; j < nx; j++) {
480 for (i = 0; i < nlines; i++) {
500 for (j = 0; j < nx; j++) {
504 for (i = 0; i < ny; i++) {
515 "Dewarp Vert Disparity",
516 "/tmp/lept/dewarp/vert_disparity.pdf");
517 lept_stderr(
"pdf file: /tmp/lept/dewarp/vert_disparity.pdf\n");
522 for (i = 0; i < ny; i++) {
523 for (j = 0; j < nx; j++) {
566 l_int32 i, j, h, nx, ny, sampling, ret, linear_edgefit;
567 l_float32 c0, c1, cl0, cl1, cl2, cr0, cr1, cr2;
568 l_float32 x, y, refl, refr;
569 l_float32 val, mederr;
575 PTA *pta, *ptat, *pta1, *pta2;
580 return ERROR_INT(
"dew not defined", __func__, 1);
583 return ERROR_INT(
"ptaa not defined", __func__, 1);
585 if (dew->
debug) L_INFO(
"finding horizontal disparity\n", __func__);
588 h = pixGetHeight(dew->
pixs);
591 L_INFO(
"Horiz disparity not built\n", __func__);
597 ptaWriteDebug(
"/tmp/lept/dewdebug/endpts_left1.pta", ptal1, 1);
598 ptaWriteDebug(
"/tmp/lept/dewdebug/endpts_right1.pta", ptar1, 1);
613 L_INFO(
"Not enough filtered end points\n", __func__);
632 if (linear_edgefit) {
637 L_INFO(
"Left linear LSF median error = %5.2f\n", __func__, mederr);
638 L_INFO(
"Left edge slope = %d\n", __func__, dew->
leftslope);
640 for (i = 0; i < ny; i++) {
650 L_INFO(
"Right linear LSF median error = %5.2f\n", __func__, mederr);
651 L_INFO(
"Right edge slope = %d\n", __func__, dew->
rightslope);
653 for (i = 0; i < ny; i++) {
663 L_INFO(
"Left quad LSF median error = %5.2f\n", __func__, mederr);
664 L_INFO(
"Left edge slope = %d\n", __func__, dew->
leftslope);
665 L_INFO(
"Left edge curvature = %d\n", __func__, dew->
leftcurv);
667 for (i = 0; i < ny; i++) {
677 L_INFO(
"Right quad LSF median error = %5.2f\n", __func__, mederr);
678 L_INFO(
"Right edge slope = %d\n", __func__, dew->
rightslope);
679 L_INFO(
"Right edge curvature = %d\n", __func__, dew->
rightcurv);
681 for (i = 0; i < ny; i++) {
689 PTA *ptalft, *ptarft;
690 h = pixGetHeight(dew->
pixs);
693 if (linear_edgefit) {
694 for (i = 0; i < h; i++) {
701 for (i = 0; i < h; i++) {
711 pixDisplay(pix1, 600, 800);
712 pixWriteDebug(
"/tmp/lept/dewmod/0051.png", pix1, IFF_PNG);
720 pixDisplay(pix1, 800, 800);
721 pixWriteDebug(
"/tmp/lept/dewmod/0052.png", pix1, IFF_PNG);
723 "Dewarp Horiz Disparity",
724 "/tmp/lept/dewarp/horiz_disparity.pdf");
725 lept_stderr(
"pdf file: /tmp/lept/dewarp/horiz_disparity.pdf\n");
739 ptaGetPt(ptal3, ny / 2, &refl, NULL);
740 ptaGetPt(ptar3, ny / 2, &refr, NULL);
743 for (i = 0; i < ny; i++) {
754 for (i = 0; i < ny; i++) {
762 for (j = 0; j < nx; j++) {
775 for (i = 0; i < ny; i++) {
776 for (j = 0; j < nx; j++) {
812 l_int32 i, w, h, bx, by, nsegs, csize1, csize2;
819 if (!pixs || pixGetDepth(pixs) != 1)
820 return (
PTAA *)ERROR_PTR(
"pixs undefined or not 1 bpp", __func__, NULL);
823 if (debugflag) L_INFO(
"finding text line centers\n", __func__);
832 csize1 = L_MAX(15, w / 80);
833 csize2 = L_MAX(40, w / 30);
834 snprintf(buf,
sizeof(buf),
"o1.3 + c%d.1 + o%d.1 + c%d.1",
835 csize1, csize1, csize2);
848 pixWriteDebug(
"/tmp/lept/dewmod/0011.tif", pix1, IFF_TIFF_G4);
849 pixDisplayWithTitle(pix1, 0, 600,
"pix1", 1);
850 pixWriteDebug(
"/tmp/lept/dewmod/0012.tif", pix2, IFF_TIFF_G4);
851 pixDisplayWithTitle(pix2, 0, 800,
"pix2", 1);
874 pixWriteDebug(
"/tmp/lept/dewmod/0013.tif", pix2, IFF_TIFF_G4);
875 pixDisplayWithTitle(pix2, 0, 1000,
"pix2", 1);
883 for (i = 0; i < nsegs; i++) {
893 pixWriteDebug(
"/tmp/lept/dewmod/0014.tif", pix2, IFF_PNG);
894 pixDisplayWithTitle(pix2, 0, 1200,
"pix3", 1);
918 l_int32 w, h, i, j, wpl, sum, count;
919 l_uint32 *line, *data;
922 if (!pixs || pixGetDepth(pixs) != 1)
923 return (
PTA *)ERROR_PTR(
"pixs undefined or not 1 bpp", __func__, NULL);
928 wpl = pixGetWpl(pixs);
929 for (j = 0; j < w; j++) {
932 for (i = 0; i < h; i++) {
939 if (count == 0)
continue;
940 ptaAddPt(pta, x + j, y + (sum / count));
963 l_int32 w, n, i, index, maxlen, len;
964 l_float32 minx, maxx;
970 if (!pixs || pixGetDepth(pixs) != 1)
971 return (
PTAA *)ERROR_PTR(
"pixs undefined or not 1 bpp", __func__, NULL);
973 return (
PTAA *)ERROR_PTR(
"ptaas undefined", __func__, NULL);
979 for (i = 0; i < n; i++) {
990 if (maxlen < 0.5 * w)
991 L_WARNING(
"lines are relatively short\n", __func__);
994 for (i = 1; i < n; i++) {
997 if (len < fract * maxlen)
break;
1005 pixDisplayWithTitle(pix2, 0, 200,
"pix4", 1);
1044 l_int32 i, n, npt, x, y;
1045 l_float32 miny, maxy, ratio;
1046 PTA *pta, *ptal1, *ptar1;
1048 if (!pptal || !pptar)
1049 return ERROR_INT(
"&ptal and &ptar not both defined", __func__, 1);
1050 *pptal = *pptar = NULL;
1052 return ERROR_INT(
"ptaa undefined", __func__, 1);
1056 if (n < MinLinesForHoriz1) {
1057 L_INFO(
"only %d lines; too few\n", __func__, n);
1064 for (i = 0; i < n; i++) {
1076 ratio = (maxy - miny) / (l_float32)h;
1077 if (ratio < MinRatioLinesToHeight) {
1078 L_INFO(
"ratio lines to height, %f, too small\n", __func__, ratio);
1123 l_float32 ymin, ymax, xvall, xvalr, yvall, yvalr;
1124 PTA *ptal1, *ptar1, *ptal2, *ptar2;
1127 return ERROR_INT(
"ptal or ptar not defined", __func__, 1);
1128 *pptalf = *pptarf = NULL;
1131 w = pixGetWidth(dew->
pixs);
1137 for (i = 0; i < n; i++) {
1140 if (yvall < ymin + 0.20 * (w - ymin) &&
1141 yvalr > 0.80 * ymax) {
1147 ptaWriteDebug(
"/tmp/lept/dewdebug/endpts_left2.pta", ptal1, 1);
1148 ptaWriteDebug(
"/tmp/lept/dewdebug/endpts_right2.pta", ptar1, 1);
1152 if (n < MinLinesForHoriz1 - 2) {
1155 L_INFO(
"First filter: only %d endpoints; needed 8\n", __func__, n);
1164 if (!ptal2 || !ptar2) {
1167 L_INFO(
"Second filter: too few endpoints left after outliers removed\n",
1172 ptaWriteDebug(
"/tmp/lept/dewdebug/endpts_left3.pta", ptal2, 1);
1173 ptaWriteDebug(
"/tmp/lept/dewdebug/endpts_right3.pta", ptar2, 1);
1204 l_int32 i, n, nu, nd;
1205 l_float32 rval, xval, yval, delta;
1206 PTA *ptau1, *ptau2, *ptad1, *ptad2;
1209 return (
PTA *)ERROR_PTR(
"ptas not defined", __func__, NULL);
1211 delta = AllowedWidthFract * w;
1219 for (i = 0; i < nu; i++) {
1221 if (L_ABS(rval - yval) <= delta)
1227 L_INFO(
"Second filter: upper set is too small after outliers removed\n",
1237 for (i = 0; i < nd; i++) {
1239 if (L_ABS(rval - yval) <= delta)
1246 L_INFO(
"Second filter: lower set is too small after outliers removed\n",
1284 l_int32 i, n, iy, both_halves, ntop, nbot, ytop, ybot, nmin;
1285 l_float32 y, fraction;
1289 return ERROR_INT(
"ptaa not defined", __func__, 0);
1291 return ERROR_INT(
"ptaa empty", __func__, 0);
1293 return ERROR_INT(
"invalid h", __func__, 0);
1294 if (!pntop || !pnbot)
1295 return ERROR_INT(
"&ntop and &nbot not defined", __func__, 0);
1296 if (!pytop || !pybot)
1297 return ERROR_INT(
"&ytop and &ybot not defined", __func__, 0);
1300 for (i = 0; i < n; i++) {
1305 for (i = 0, ntop = 0; i < n; i++) {
1307 if (i == 0) ytop = iy;
1308 if (i == n - 1) ybot = iy;
1319 both_halves = (ntop >= nmin) && (nbot >= nmin);
1320 fraction = (l_float32)(ybot - ytop) / (l_float32)h;
1321 if (both_halves && fraction > 0.50)
1351 l_float32 x, y, xp, c0, c1;
1354 if (pmederr) *pmederr = 0.0;
1356 return ERROR_INT(
"not all ptrs are defined", __func__, 1);
1359 return ERROR_INT(
"ptad not defined", __func__, 1);
1370 for (i = 0; i < n; i++) {
1408 l_float32 x, y, xp, c0, c1, c2;
1411 if (pmederr) *pmederr = 0.0;
1412 if (!pa || !pb || !pc)
1413 return ERROR_INT(
"not all ptrs are defined", __func__, 1);
1414 *pa = *pb = *pc = 0.0;
1416 return ERROR_INT(
"ptad not defined", __func__, 1);
1428 for (i = 0; i < n; i++) {
1484 l_float32 fractthresh,
1487 l_int32 i, j, x, n1, n2, nb, ne, count, w, h, ival, prev;
1488 l_int32 istart, iend, first, last, x0, x1, nx, ny;
1489 l_float32 fract, delta, sum, aveval, fval, del, denom;
1490 l_float32 ca, cb, cc, cd, ce, y;
1492 BOXA *boxa1, *boxa2;
1494 NUMA *na1, *na2, *na3, *na4, *nasum;
1500 return ERROR_INT(
"dew not defined", __func__, 1);
1502 return ERROR_INT(
"invalid vert or horiz disparity model", __func__, 1);
1503 if (!pixb || pixGetDepth(pixb) != 1)
1504 return ERROR_INT(
"pixb not defined or not 1 bpp", __func__, 1);
1506 if (dew->
debug) L_INFO(
"finding slope horizontal disparity\n", __func__);
1510 pixDisplay(pix1, 100, 100);
1522 for (x = 0; x + 50 < w; x += 25) {
1530 gplotSimple1(na1, GPLOT_PNG,
"/tmp/lept/dew/0091", NULL);
1531 lept_mv(
"/tmp/lept/dew/0091.png",
"lept/dewmod", NULL, NULL);
1532 pixWriteDebug(
"/tmp/lept/dewmod/0090.png", pix1, IFF_PNG);
1543 for (i = 0; i < n1; i++) {
1557 for (i = n1 - 1; i >= 0; i--) {
1571 delta = (parity == 0) ? last - first : first - last;
1572 denom = L_MAX(1.0, (l_float32)(L_MIN(first, last)));
1573 fract = (l_float32)delta / denom;
1575 L_INFO(
"Slope-disparity: first = %d, last = %d, fract = %7.3f\n",
1576 __func__, first, last, fract);
1577 gplotSimple1(na2, GPLOT_PNG,
"/tmp/lept/dew/0092", NULL);
1578 lept_mv(
"/tmp/lept/dew/0092.png",
"lept/dewmod", NULL, NULL);
1580 if (fract < fractthresh) {
1581 L_INFO(
"Small slope-disparity: first = %d, last = %d, fract = %7.3f\n",
1582 __func__, first, last, fract);
1593 denom = L_MAX(1.0, (l_float32)(ne / 2));
1594 aveval = sum / denom;
1599 L_INFO(
"Average background density: %5.1f\n", __func__, aveval);
1600 gplotSimple1(na2, GPLOT_PNG,
"/tmp/lept/dew/0093", NULL);
1601 lept_mv(
"/tmp/lept/dew/0093.png",
"lept/dewmod", NULL, NULL);
1612 "/tmp/lept/dew/0094", NULL);
1614 lept_mv(
"/tmp/lept/dew/0094.png",
"lept/dewmod", NULL, NULL);
1622 for (i = n2 - 1; i >= 0; i--) {
1624 if (fval < 1.0)
break;
1630 for (x = x0; x < x1; x++) {
1635 for (x = x1; x < w; x++)
1638 for (i = 0; i < n2; i++) {
1640 if (fval < 1.0)
break;
1646 for (x = x1; x >= x0; x--) {
1651 for (x = x0; x >= 0; x--)
1659 del = (l_float32)w / (l_float32)nx;
1660 for (i = 0; i < ny; i++) {
1661 for (j = 0; j < nx; j++) {
1712 const char *debugfile)
1715 l_int32 i, j, bx, by, ret, nlines;
1717 PIX *pixs, *pixh, *pixv, *pix, *pix1, *pix2;
1718 PIXA *pixa1, *pixa2;
1720 PTAA *ptaa1, *ptaa2;
1723 return ERROR_INT(
"dew not defined", __func__, 1);
1725 L_WARNING(
"opensize should be >= 3; setting to 8\n", __func__);
1729 dew->
debug = (debugfile) ? 1 : 0;
1738 pixDisplayWithTitle(pixs, 0, 0,
"pixs", 1);
1739 pixWriteDebug(
"/tmp/lept/dewline/001.png", pixs, IFF_PNG);
1753 snprintf(buf,
sizeof(buf),
"d1.3 + c%d.1 + o%d.1", opensize - 2, opensize);
1755 snprintf(buf,
sizeof(buf),
"d3.1 + c1.%d + o1.%d", opensize - 2, opensize);
1766 for (i = 0; i < 2; i++) {
1768 pixDisplay(pix, 0, 900);
1772 if (nlines < dew->minlines) {
1773 L_WARNING(
"only found %d lines\n", __func__, nlines);
1781 for (j = 0; j < nlines; j++) {
1792 snprintf(buf,
sizeof(buf),
"/tmp/lept/dewline/%03d.png", 2 + 2 * i);
1793 pixWriteDebug(buf, pix2, IFF_PNG);
1804 snprintf(buf,
sizeof(buf),
"/tmp/lept/dewline/%03d.png", 3 + 2 * i);
1805 pixWriteDebug(buf, pix2, IFF_PNG);
1811 if (nlines < dew->minlines) {
1814 L_WARNING(
"%d lines: too few to build model\n", __func__, nlines);
1828 L_WARNING(
"horizontal disparity not built\n", __func__);
1830 L_INFO(
"hsuccess = 1\n", __func__);
1834 lept_mv(
"/tmp/lept/dewarp/vert_disparity.pdf",
1835 "lept/dewarp",
"horiz_disparity.pdf", NULL);
1841 L_WARNING(
"vertical disparity not built\n", __func__);
1843 L_INFO(
"vsuccess = 1\n", __func__);
1855 pixWriteDebug(
"/tmp/lept/dewline/006.png", pix1, IFF_PNG);
1856 pixDisplay(pix1, 1000, 0);
1861 pixWriteDebug(
"/tmp/lept/dewline/007.png", pix1, IFF_PNG);
1862 pixDisplay(pix1, 1000, 0);
1866 "Dewarp Build Line Model", debugfile);
1899 if (pvsuccess) *pvsuccess = 0;
1900 if (phsuccess) *phsuccess = 0;
1902 return ERROR_INT(
"dewa not defined", __func__, 1);
1905 return ERROR_INT(
"dew not retrieved", __func__, 1);
1906 if (pvsuccess) *pvsuccess = dew->
vsuccess;
1907 if (phsuccess) *phsuccess = dew->
hsuccess;
1928 l_int32 i, n, w, yval, rval, gval, bval;
1932 return ERROR_INT(
"pixs not defined", __func__, 1);
1934 return ERROR_INT(
"namidys not defined", __func__, 1);
1936 w = pixGetWidth(pixs);
1939 for (i = 0; i < n; i++) {
1965 PTA *ptalt, *ptart, *ptacirc;
1968 return ERROR_INT(
"pixs not defined", __func__, 1);
1970 return ERROR_INT(
"ptal and ptar not both defined", __func__, 1);
#define GET_DATA_BIT(pdata, n)
void boxDestroy(BOX **pbox)
boxDestroy()
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
l_int32 boxaGetCount(const BOXA *boxa)
boxaGetCount()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
l_ok boxaContainedInBoxCount(BOXA *boxa, BOX *box, l_int32 *pcount)
boxaContainedInBoxCount()
BOXA * boxaSelectBySize(BOXA *boxas, l_int32 width, l_int32 height, l_int32 type, l_int32 relation, l_int32 *pchanged)
boxaSelectBySize()
void pixcmapDestroy(PIXCMAP **pcmap)
pixcmapDestroy()
PIXCMAP * pixcmapCreateRandom(l_int32 depth, l_int32 hasblack, l_int32 haswhite)
pixcmapCreateRandom()
l_ok pixcmapGetColor(PIXCMAP *cmap, l_int32 index, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
pixcmapGetColor()
BOXA * pixConnCompBB(PIX *pixs, l_int32 connectivity)
pixConnCompBB()
BOXA * pixConnComp(PIX *pixs, PIXA **ppixa, l_int32 connectivity)
pixConnComp()
L_DEWARP * dewarpaGetDewarp(L_DEWARPA *dewa, l_int32 index)
dewarpaGetDewarp()
static l_int32 pixRenderMidYs(PIX *pixs, NUMA *namidys, l_int32 linew)
pixRenderMidYs()
static l_int32 dewarpFilterLineEndPoints(L_DEWARP *dew, PTA *ptal1, PTA *ptar1, PTA **pptal2, PTA **pptar2)
dewarpFilterLineEndPoints()
l_ok dewarpFindHorizDisparity(L_DEWARP *dew, PTAA *ptaa)
dewarpFindHorizDisparity()
static l_int32 dewarpLinearLSF(PTA *ptad, l_float32 *pa, l_float32 *pb, l_float32 *pmederr)
dewarpLinearLSF()
static l_int32 pixRenderHorizEndPoints(PIX *pixs, PTA *ptal, PTA *ptar, l_uint32 color)
pixRenderHorizEndPoints()
l_ok dewarpBuildPageModel(L_DEWARP *dew, const char *debugfile)
dewarpBuildPageModel()
static PTA * dewarpRemoveBadEndPoints(l_int32 w, PTA *ptas)
dewarpRemoveBadEndPoints()
l_ok dewarpBuildLineModel(L_DEWARP *dew, l_int32 opensize, const char *debugfile)
dewarpBuildLineModel()
PTAA * dewarpRemoveShortLines(PIX *pixs, PTAA *ptaas, l_float32 fract, l_int32 debugflag)
dewarpRemoveShortLines()
static l_int32 dewarpGetLineEndPoints(l_int32 h, PTAA *ptaa, PTA **pptal, PTA **pptar)
dewarpGetLineEndPoints()
static PTA * dewarpGetMeanVerticals(PIX *pixs, l_int32 x, l_int32 y)
dewarpGetMeanVerticals()
static l_int32 dewarpQuadraticLSF(PTA *ptad, l_float32 *pa, l_float32 *pb, l_float32 *pc, l_float32 *pmederr)
dewarpQuadraticLSF()
static l_int32 dewarpIsLineCoverageValid(PTAA *ptaa2, l_int32 h, l_int32 *pntop, l_int32 *pnbot, l_int32 *pytop, l_int32 *pybot)
dewarpIsLineCoverageValid()
l_ok dewarpaModelStatus(L_DEWARPA *dewa, l_int32 pageno, l_int32 *pvsuccess, l_int32 *phsuccess)
dewarpaModelStatus()
PTAA * dewarpGetTextlineCenters(PIX *pixs, l_int32 debugflag)
dewarpGetTextlineCenters()
l_ok dewarpFindVertDisparity(L_DEWARP *dew, PTAA *ptaa, l_int32 rotflag)
dewarpFindVertDisparity()
l_ok dewarpFindHorizSlopeDisparity(L_DEWARP *dew, PIX *pixb, l_float32 fractthresh, l_int32 parity)
dewarpFindHorizSlopeDisparity()
l_ok dewarpPopulateFullRes(L_DEWARP *dew, PIX *pix, l_int32 x, l_int32 y)
dewarpPopulateFullRes()
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()
FPIX * fpixRotateOrth(FPIX *fpixs, l_int32 quads)
fpixRotateOrth()
GPLOT * gplotSimpleXY1(NUMA *nax, NUMA *nay, l_int32 plotstyle, l_int32 outformat, const char *outroot, const char *title)
gplotSimpleXY1()
void gplotDestroy(GPLOT **pgplot)
gplotDestroy()
l_ok gplotSimple1(NUMA *na, l_int32 outformat, const char *outroot, const char *title)
gplotSimple1()
l_ok pixRenderLineArb(PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderLineArb()
PTA * generatePtaFilledCircle(l_int32 radius)
generatePtaFilledCircle()
PIX * fpixRenderContours(FPIX *fpixs, l_float32 incr, l_float32 proxim)
fpixRenderContours()
PIX * pixMorphSequence(PIX *pixs, const char *sequence, l_int32 dispsep)
pixMorphSequence()
l_ok numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
l_ok numaReplaceNumber(NUMA *na, l_int32 index, l_float32 val)
numaReplaceNumber()
l_ok numaGetFValue(NUMA *na, l_int32 index, l_float32 *pval)
numaGetFValue()
NUMA * numaCreate(l_int32 n)
numaCreate()
void numaDestroy(NUMA **pna)
numaDestroy()
l_int32 numaGetCount(NUMA *na)
numaGetCount()
l_ok numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_ok numaWriteDebug(const char *filename, NUMA *na)
numaWriteDebug()
l_ok numaSetParameters(NUMA *na, l_float32 startx, l_float32 delx)
numaSetParameters()
l_float32 * numaGetFArray(NUMA *na, l_int32 copyflag)
numaGetFArray()
NUMA * numaSort(NUMA *naout, NUMA *nain, l_int32 sortorder)
numaSort()
l_ok numaGetMedianDevFromMedian(NUMA *na, l_float32 *pmed, l_float32 *pdev)
numaGetMedianDevFromMedian()
l_ok numaGetMedian(NUMA *na, l_float32 *pval)
numaGetMedian()
NUMA * numaGetSortIndex(NUMA *na, l_int32 sortorder)
numaGetSortIndex()
l_ok numaGetSumOnInterval(NUMA *na, l_int32 first, l_int32 last, l_float32 *psum)
numaGetSumOnInterval()
l_ok numaGetMin(NUMA *na, l_float32 *pminval, l_int32 *piminloc)
numaGetMin()
NUMA * numaMakeConstant(l_float32 val, l_int32 size)
numaMakeConstant()
NUMA * numaClipToInterval(NUMA *nas, l_int32 first, l_int32 last)
numaClipToInterval()
l_ok numaGetMax(NUMA *na, l_float32 *pmaxval, l_int32 *pimaxloc)
numaGetMax()
NUMA * numaArithOp(NUMA *nad, NUMA *na1, NUMA *na2, l_int32 op)
numaArithOp()
NUMA * numaSortByIndex(NUMA *nas, NUMA *naindex)
numaSortByIndex()
l_ok convertFilesToPdf(const char *dirname, const char *substr, l_int32 res, l_float32 scalefactor, l_int32 type, l_int32 quality, const char *title, const char *fileout)
convertFilesToPdf()
l_uint32 * pixGetData(PIX *pix)
pixGetData()
void pixDestroy(PIX **ppix)
pixDestroy()
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
PIX * pixCopy(PIX *pixd, const PIX *pixs)
pixCopy()
PIX * pixCreateTemplate(const PIX *pixs)
pixCreateTemplate()
PIX * pixClone(PIX *pixs)
pixClone()
PIX * pixXor(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixXor()
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
void pixaDestroy(PIXA **ppixa)
pixaDestroy()
PIXA * pixaCreate(l_int32 n)
pixaCreate()
l_int32 pixaGetCount(PIXA *pixa)
pixaGetCount()
l_ok pixaGetBoxGeometry(PIXA *pixa, l_int32 index, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
pixaGetBoxGeometry()
PIX * pixaGetPix(PIXA *pixa, l_int32 index, l_int32 accesstype)
pixaGetPix()
PIXA * pixaSelectBySize(PIXA *pixas, l_int32 width, l_int32 height, l_int32 type, l_int32 relation, l_int32 *pchanged)
pixaSelectBySize()
PIX * pixaDisplay(PIXA *pixa, l_int32 w, l_int32 h)
pixaDisplay()
PIX * pixConvertTo32(PIX *pixs)
pixConvertTo32()
l_ok ptaWriteStream(FILE *fp, PTA *pta, l_int32 type)
ptaWriteStream()
PTA * ptaCreateFromNuma(NUMA *nax, NUMA *nay)
ptaCreateFromNuma()
PTAA * ptaaCreate(l_int32 n)
ptaaCreate()
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 ptaWriteDebug(const char *filename, PTA *pta, l_int32 type)
ptaWriteDebug()
l_ok ptaaAddPta(PTAA *ptaa, PTA *pta, l_int32 copyflag)
ptaaAddPta()
l_int32 ptaaGetCount(PTAA *ptaa)
ptaaGetCount()
l_ok ptaaGetPt(PTAA *ptaa, l_int32 ipta, l_int32 jpt, l_float32 *px, l_float32 *py)
ptaaGetPt()
l_ok ptaAddPt(PTA *pta, l_float32 x, l_float32 y)
ptaAddPt()
l_ok ptaaWriteDebug(const char *filename, PTAA *ptaa, l_int32 type)
ptaaWriteDebug()
l_ok ptaGetArrays(PTA *pta, NUMA **pnax, NUMA **pnay)
ptaGetArrays()
l_ok ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
ptaGetPt()
l_int32 ptaGetCount(PTA *pta)
ptaGetCount()
void ptaaDestroy(PTAA **pptaa)
ptaaDestroy()
PTA * ptaCreate(l_int32 n)
ptaCreate()
void ptaDestroy(PTA **ppta)
ptaDestroy()
l_ok applyLinearFit(l_float32 a, l_float32 b, l_float32 x, l_float32 *py)
applyLinearFit()
l_ok ptaGetQuarticLSF(PTA *pta, l_float32 *pa, l_float32 *pb, l_float32 *pc, l_float32 *pd, l_float32 *pe, NUMA **pnafit)
ptaGetQuarticLSF()
PIX * pixDisplayPtaPattern(PIX *pixd, PIX *pixs, PTA *pta, PIX *pixp, l_int32 cx, l_int32 cy, l_uint32 color)
pixDisplayPtaPattern()
PTA * numaConvertToPta1(NUMA *na)
numaConvertToPta1()
l_ok applyQuadraticFit(l_float32 a, l_float32 b, l_float32 c, l_float32 x, l_float32 *py)
applyQuadraticFit()
PTA * ptaTranspose(PTA *ptas)
ptaTranspose()
PIX * pixDisplayPtaa(PIX *pixs, PTAA *ptaa)
pixDisplayPtaa()
PTA * ptaSelectRange(PTA *ptas, l_int32 first, l_int32 last)
ptaSelectRange()
l_ok ptaGetMinMax(PTA *pta, l_float32 *pxmin, l_float32 *pymin, l_float32 *pxmax, l_float32 *pymax)
ptaGetMinMax()
l_ok applyQuarticFit(l_float32 a, l_float32 b, l_float32 c, l_float32 d, l_float32 e, l_float32 x, l_float32 *py)
applyQuarticFit()
l_ok ptaGetQuadraticLSF(PTA *pta, l_float32 *pa, l_float32 *pb, l_float32 *pc, NUMA **pnafit)
ptaGetQuadraticLSF()
l_ok ptaGetLinearLSF(PTA *pta, l_float32 *pa, l_float32 *pb, NUMA **pnafit)
ptaGetLinearLSF()
l_ok ptaJoin(PTA *ptad, PTA *ptas, l_int32 istart, l_int32 iend)
ptaJoin()
PIX * pixDisplayPtaaPattern(PIX *pixd, PIX *pixs, PTAA *ptaa, PIX *pixp, l_int32 cx, l_int32 cy)
pixDisplayPtaaPattern()
l_ok ptaGetRange(PTA *pta, l_float32 *pminx, l_float32 *pmaxx, l_float32 *pminy, l_float32 *pmaxy)
ptaGetRange()
PIX * pixGenerateFromPta(PTA *pta, l_int32 w, l_int32 h)
pixGenerateFromPta()
PIX * pixDisplayPta(PIX *pixd, PIX *pixs, PTA *pta)
pixDisplayPta()
PTA * ptaSort(PTA *ptas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex)
ptaSort()
PTAA * ptaaSortByIndex(PTAA *ptaas, NUMA *naindex)
ptaaSortByIndex()
l_ok ptaGetRankValue(PTA *pta, l_float32 fract, PTA *ptasort, l_int32 sorttype, l_float32 *pval)
ptaGetRankValue()
PIX * pixRotateOrth(PIX *pixs, l_int32 quads)
pixRotateOrth()
PIX * pixSeedfillBinary(PIX *pixd, PIX *pixs, PIX *pixm, l_int32 connectivity)
pixSeedfillBinary()
struct FPix * fullvdispar
struct FPix * fullhdispar
struct FPix * sampydispar
struct FPix * sampvdispar
struct FPix * samphdispar
void lept_stderr(const char *fmt,...)
lept_stderr()
l_int32 lept_roundftoi(l_float32 fval)
lept_roundftoi()
l_int32 lept_rmdir(const char *subdir)
lept_rmdir()
l_int32 lept_mv(const char *srcfile, const char *newdir, const char *newtail, char **pnewpath)
lept_mv()
l_int32 lept_mkdir(const char *subdir)
lept_mkdir()