134 #include "allheaders.h" 154 #ifndef NO_CONSOLE_IO 155 #define DEBUG_GLOBAL 0 195 PROCNAME(
"pixCleanBackgroundToWhite");
198 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
199 d = pixGetDepth(pixs);
200 if (d != 8 && d != 32)
201 return (
PIX *)ERROR_PTR(
"depth not 8 or 32", procName, NULL);
204 pixGammaTRC(pixd, pixd, gamma, blackval, whiteval);
312 PIX *pixm, *pixmi, *pixd;
313 PIX *pixmr, *pixmg, *pixmb, *pixmri, *pixmgi, *pixmbi;
315 PROCNAME(
"pixBackgroundNorm");
318 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
319 d = pixGetDepth(pixs);
320 if (d != 8 && d != 32)
321 return (
PIX *)ERROR_PTR(
"pixs not 8 or 32 bpp", procName, NULL);
322 if (sx < 4 || sy < 4)
323 return (
PIX *)ERROR_PTR(
"sx and sy must be >= 4", procName, NULL);
324 if (mincount > sx * sy) {
325 L_WARNING(
"mincount too large for tile size\n", procName);
326 mincount = (sx * sy) / 3;
335 return (
PIX *)ERROR_PTR(
"pixim all foreground", procName, NULL);
343 L_WARNING(
"map not made; return a copy of the source\n", procName);
349 ERROR_PTR(
"pixmi not made", procName, NULL);
357 pixmr = pixmg = pixmb = NULL;
359 mincount, &pixmr, &pixmg, &pixmb);
360 if (!pixmr || !pixmg || !pixmb) {
364 L_WARNING(
"map not made; return a copy of the source\n", procName);
371 if (!pixmri || !pixmgi || !pixmbi)
372 ERROR_PTR(
"not all pixm*i are made", procName, NULL);
386 ERROR_PTR(
"pixd not made", procName, NULL);
387 pixCopyResolution(pixd, pixs);
439 PIX *pixm, *pixmi, *pixd;
440 PIX *pixmr, *pixmg, *pixmb, *pixmri, *pixmgi, *pixmbi;
442 PROCNAME(
"pixBackgroundNormMorph");
445 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
446 d = pixGetDepth(pixs);
447 if (d != 8 && d != 32)
448 return (
PIX *)ERROR_PTR(
"pixs not 8 or 32 bpp", procName, NULL);
449 if (reduction < 2 || reduction > 16)
450 return (
PIX *)ERROR_PTR(
"reduction must be between 2 and 16",
459 return (
PIX *)ERROR_PTR(
"pixim all foreground", procName, NULL);
466 return (
PIX *)ERROR_PTR(
"pixm not made", procName, NULL);
469 ERROR_PTR(
"pixmi not made", procName, NULL);
472 reduction, reduction);
477 pixmr = pixmg = pixmb = NULL;
479 &pixmr, &pixmg, &pixmb);
480 if (!pixmr || !pixmg || !pixmb) {
484 return (
PIX *)ERROR_PTR(
"not all pixm*", procName, NULL);
490 if (!pixmri || !pixmgi || !pixmbi)
491 ERROR_PTR(
"not all pixm*i are made", procName, NULL);
494 reduction, reduction);
505 ERROR_PTR(
"pixd not made", procName, NULL);
506 pixCopyResolution(pixd, pixs);
557 PROCNAME(
"pixBackgroundNormGrayArray");
560 return ERROR_INT(
"&pixd not defined", procName, 1);
562 if (!pixs || pixGetDepth(pixs) != 8)
563 return ERROR_INT(
"pixs not defined or not 8 bpp", procName, 1);
564 if (pixGetColormap(pixs))
565 return ERROR_INT(
"pixs is colormapped", procName, 1);
566 if (pixim && pixGetDepth(pixim) != 1)
567 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
568 if (sx < 4 || sy < 4)
569 return ERROR_INT(
"sx and sy must be >= 4", procName, 1);
570 if (mincount > sx * sy) {
571 L_WARNING(
"mincount too large for tile size\n", procName);
572 mincount = (sx * sy) / 3;
581 return ERROR_INT(
"pixim all foreground", procName, 1);
586 return ERROR_INT(
"pixm not made", procName, 1);
588 pixCopyResolution(*ppixd, pixs);
635 PIX *pixmr, *pixmg, *pixmb;
637 PROCNAME(
"pixBackgroundNormRGBArrays");
639 if (!ppixr || !ppixg || !ppixb)
640 return ERROR_INT(
"&pixr, &pixg, &pixb not all defined", procName, 1);
641 *ppixr = *ppixg = *ppixb = NULL;
643 return ERROR_INT(
"pixs not defined", procName, 1);
644 if (pixGetDepth(pixs) != 32)
645 return ERROR_INT(
"pixs not 32 bpp", procName, 1);
646 if (pixim && pixGetDepth(pixim) != 1)
647 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
648 if (sx < 4 || sy < 4)
649 return ERROR_INT(
"sx and sy must be >= 4", procName, 1);
650 if (mincount > sx * sy) {
651 L_WARNING(
"mincount too large for tile size\n", procName);
652 mincount = (sx * sy) / 3;
661 return ERROR_INT(
"pixim all foreground", procName, 1);
665 &pixmr, &pixmg, &pixmb);
666 if (!pixmr || !pixmg || !pixmb) {
670 return ERROR_INT(
"not all pixm* made", procName, 1);
713 PROCNAME(
"pixBackgroundNormGrayArrayMorph");
716 return ERROR_INT(
"&pixd not defined", procName, 1);
719 return ERROR_INT(
"pixs not defined", procName, 1);
720 if (pixGetDepth(pixs) != 8)
721 return ERROR_INT(
"pixs not 8 bpp", procName, 1);
722 if (pixim && pixGetDepth(pixim) != 1)
723 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
724 if (reduction < 2 || reduction > 16)
725 return ERROR_INT(
"reduction must be between 2 and 16", procName, 1);
733 return ERROR_INT(
"pixim all foreground", procName, 1);
738 return ERROR_INT(
"pixm not made", procName, 1);
740 pixCopyResolution(*ppixd, pixs);
778 PIX *pixmr, *pixmg, *pixmb;
780 PROCNAME(
"pixBackgroundNormRGBArraysMorph");
782 if (!ppixr || !ppixg || !ppixb)
783 return ERROR_INT(
"&pixr, &pixg, &pixb not all defined", procName, 1);
784 *ppixr = *ppixg = *ppixb = NULL;
786 return ERROR_INT(
"pixs not defined", procName, 1);
787 if (pixGetDepth(pixs) != 32)
788 return ERROR_INT(
"pixs not 32 bpp", procName, 1);
789 if (pixim && pixGetDepth(pixim) != 1)
790 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
791 if (reduction < 2 || reduction > 16)
792 return ERROR_INT(
"reduction must be between 2 and 16", procName, 1);
800 return ERROR_INT(
"pixim all foreground", procName, 1);
804 &pixmr, &pixmg, &pixmb);
805 if (!pixmr || !pixmg || !pixmb) {
809 return ERROR_INT(
"not all pixm* made", procName, 1);
853 l_int32 w, h, wd, hd, wim, him, wpls, wplim, wpld, wplf;
854 l_int32 xim, yim, delx, nx, ny, i, j, k, m;
855 l_int32 count, sum, val8;
856 l_int32 empty, fgpixels;
857 l_uint32 *datas, *dataim, *datad, *dataf, *lines, *lineim, *lined, *linef;
858 l_float32 scalex, scaley;
859 PIX *pixd, *piximi, *pixb, *pixf, *pixims;
861 PROCNAME(
"pixGetBackgroundGrayMap");
864 return ERROR_INT(
"&pixd not defined", procName, 1);
866 if (!pixs || pixGetDepth(pixs) != 8)
867 return ERROR_INT(
"pixs not defined or not 8 bpp", procName, 1);
868 if (pixGetColormap(pixs))
869 return ERROR_INT(
"pixs is colormapped", procName, 1);
870 if (pixim && pixGetDepth(pixim) != 1)
871 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
872 if (sx < 4 || sy < 4)
873 return ERROR_INT(
"sx and sy must be >= 4", procName, 1);
874 if (mincount > sx * sy) {
875 L_WARNING(
"mincount too large for tile size\n", procName);
876 mincount = (sx * sy) / 3;
887 return ERROR_INT(
"pixim all fg; no background", procName, 1);
903 w = pixGetWidth(pixs);
904 h = pixGetHeight(pixs);
905 wd = (w + sx - 1) / sx;
906 hd = (h + sy - 1) / sy;
914 wpls = pixGetWpl(pixs);
916 wpld = pixGetWpl(pixd);
918 wplf = pixGetWpl(pixf);
920 for (i = 0; i < ny; i++) {
921 lines = datas + sy * i * wpls;
922 linef = dataf + sy * i * wplf;
923 lined = datad + i * wpld;
924 for (j = 0; j < nx; j++) {
928 for (k = 0; k < sy; k++) {
929 for (m = 0; m < sx; m++) {
936 if (count >= mincount) {
955 if (pixim && fgpixels) {
956 wim = pixGetWidth(pixim);
957 him = pixGetHeight(pixim);
959 wplim = pixGetWpl(pixim);
960 for (i = 0; i < ny; i++) {
961 yim = i * sy + sy / 2;
964 lineim = dataim + yim * wplim;
965 for (j = 0; j < nx; j++) {
966 xim = j * sx + sx / 2;
978 L_WARNING(
"can't make the map\n", procName);
987 if (pixim && fgpixels) {
988 scalex = 1. / (l_float32)sx;
989 scaley = 1. / (l_float32)sy;
996 pixCopyResolution(*ppixd, pixs);
1034 l_int32 w, h, wm, hm, wim, him, wpls, wplim, wplf;
1035 l_int32 xim, yim, delx, nx, ny, i, j, k, m;
1036 l_int32 count, rsum, gsum, bsum, rval, gval, bval;
1037 l_int32 empty, fgpixels;
1039 l_uint32 *datas, *dataim, *dataf, *lines, *lineim, *linef;
1040 l_float32 scalex, scaley;
1041 PIX *piximi, *pixgc, *pixb, *pixf, *pixims;
1042 PIX *pixmr, *pixmg, *pixmb;
1044 PROCNAME(
"pixGetBackgroundRGBMap");
1046 if (!ppixmr || !ppixmg || !ppixmb)
1047 return ERROR_INT(
"&pixm* not all defined", procName, 1);
1048 *ppixmr = *ppixmg = *ppixmb = NULL;
1050 return ERROR_INT(
"pixs not defined", procName, 1);
1051 if (pixGetDepth(pixs) != 32)
1052 return ERROR_INT(
"pixs not 32 bpp", procName, 1);
1053 if (pixim && pixGetDepth(pixim) != 1)
1054 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
1055 if (sx < 4 || sy < 4)
1056 return ERROR_INT(
"sx and sy must be >= 4", procName, 1);
1057 if (mincount > sx * sy) {
1058 L_WARNING(
"mincount too large for tile size\n", procName);
1059 mincount = (sx * sy) / 3;
1069 return ERROR_INT(
"pixim all fg; no background", procName, 1);
1087 w = pixGetWidth(pixs);
1088 h = pixGetHeight(pixs);
1089 wm = (w + sx - 1) / sx;
1090 hm = (h + sy - 1) / sy;
1101 wpls = pixGetWpl(pixs);
1103 wplf = pixGetWpl(pixf);
1105 for (i = 0; i < ny; i++) {
1106 lines = datas + sy * i * wpls;
1107 linef = dataf + sy * i * wplf;
1108 for (j = 0; j < nx; j++) {
1110 rsum = gsum = bsum = 0;
1112 for (k = 0; k < sy; k++) {
1113 for (m = 0; m < sx; m++) {
1115 pixel = *(lines + k * wpls + delx + m);
1116 rsum += (pixel >> 24);
1117 gsum += ((pixel >> 16) & 0xff);
1118 bsum += ((pixel >> 8) & 0xff);
1123 if (count >= mincount) {
1124 rval = rsum / count;
1125 gval = gsum / count;
1126 bval = bsum / count;
1141 wim = pixGetWidth(pixim);
1142 him = pixGetHeight(pixim);
1144 wplim = pixGetWpl(pixim);
1145 for (i = 0; i < ny; i++) {
1146 yim = i * sy + sy / 2;
1149 lineim = dataim + yim * wplim;
1150 for (j = 0; j < nx; j++) {
1151 xim = j * sx + sx / 2;
1170 L_WARNING(
"can't make the maps\n", procName);
1176 if (pixim && fgpixels) {
1177 scalex = 1. / (l_float32)sx;
1178 scaley = 1. / (l_float32)sy;
1189 pixCopyResolution(*ppixmr, pixs);
1190 pixCopyResolution(*ppixmg, pixs);
1191 pixCopyResolution(*ppixmb, pixs);
1214 l_int32 nx, ny, empty, fgpixels;
1216 PIX *pixm, *pix1, *pix2, *pix3, *pixims;
1218 PROCNAME(
"pixGetBackgroundGrayMapMorph");
1221 return ERROR_INT(
"&pixm not defined", procName, 1);
1223 if (!pixs || pixGetDepth(pixs) != 8)
1224 return ERROR_INT(
"pixs not defined or not 8 bpp", procName, 1);
1225 if (pixGetColormap(pixs))
1226 return ERROR_INT(
"pixs is colormapped", procName, 1);
1227 if (pixim && pixGetDepth(pixim) != 1)
1228 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
1236 return ERROR_INT(
"pixim all fg; no background", procName, 1);
1244 scale = 1. / (l_float32)reduction;
1255 pixims =
pixScale(pixim, scale, scale);
1257 pixAnd(pixm, pixm, pix3);
1264 nx = pixGetWidth(pixs) / reduction;
1265 ny = pixGetHeight(pixs) / reduction;
1269 L_WARNING(
"can't make the map\n", procName);
1275 if (pixim && fgpixels)
1280 pixCopyResolution(*ppixm, pixs);
1307 l_int32 nx, ny, empty, fgpixels;
1309 PIX *pixm, *pixmr, *pixmg, *pixmb, *pix1, *pix2, *pix3, *pixims;
1311 PROCNAME(
"pixGetBackgroundRGBMapMorph");
1313 if (!ppixmr || !ppixmg || !ppixmb)
1314 return ERROR_INT(
"&pixm* not all defined", procName, 1);
1315 *ppixmr = *ppixmg = *ppixmb = NULL;
1317 return ERROR_INT(
"pixs not defined", procName, 1);
1318 if (pixGetDepth(pixs) != 32)
1319 return ERROR_INT(
"pixs not 32 bpp", procName, 1);
1320 if (pixim && pixGetDepth(pixim) != 1)
1321 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
1329 return ERROR_INT(
"pixim all fg; no background", procName, 1);
1337 scale = 1. / (l_float32)reduction;
1341 pixims =
pixScale(pixim, scale, scale);
1352 pixmr =
pixAnd(NULL, pixm, pix3);
1363 pixmg =
pixAnd(NULL, pixm, pix3);
1374 pixmb =
pixAnd(NULL, pixm, pix3);
1383 nx = pixGetWidth(pixs) / reduction;
1384 ny = pixGetHeight(pixs) / reduction;
1392 L_WARNING(
"can't make the maps\n", procName);
1399 if (pixim && fgpixels) {
1409 pixCopyResolution(*ppixmr, pixs);
1410 pixCopyResolution(*ppixmg, pixs);
1411 pixCopyResolution(*ppixmb, pixs);
1458 l_int32 w, h, y, nmiss, goodcol, i, j, found, ival, valtest;
1459 l_uint32 val, lastval;
1463 PROCNAME(
"pixFillMapHoles");
1465 if (!pix || pixGetDepth(pix) != 8)
1466 return ERROR_INT(
"pix not defined or not 8 bpp", procName, 1);
1467 if (pixGetColormap(pix))
1468 return ERROR_INT(
"pix is colormapped", procName, 1);
1475 for (j = 0; j < nx; j++) {
1477 for (i = 0; i < ny; i++) {
1479 if (val != valtest) {
1485 if (found == FALSE) {
1491 for (i = y - 1; i >= 0; i--)
1494 for (i = 1; i < h; i++) {
1507 L_WARNING(
"no bg found; no data in any column\n", procName);
1516 for (j = 0; j < w; j++) {
1524 for (j = goodcol - 1; j >= 0; j--) {
1529 for (j = goodcol + 1; j < w; j++) {
1540 for (i = 0; i < h; i++) {
1573 PROCNAME(
"pixExtendByReplication");
1575 if (!pixs || pixGetDepth(pixs) != 8)
1576 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", procName, NULL);
1578 if (addw == 0 && addh == 0)
1582 if ((pixd =
pixCreate(w + addw, h + addh, 8)) == NULL)
1583 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
1587 for (i = 0; i < h; i++) {
1589 for (j = 0; j < addw; j++)
1595 for (j = 0; j < w + addw; j++) {
1597 for (i = 0; i < addh; i++)
1602 pixCopyResolution(pixd, pixs);
1632 l_int32 empty, i, n, x, y;
1638 PROCNAME(
"pixSmoothConnectedRegions");
1640 if (!pixs || pixGetDepth(pixs) != 8)
1641 return ERROR_INT(
"pixs not defined or not 8 bpp", procName, 1);
1642 if (pixGetColormap(pixs))
1643 return ERROR_INT(
"pixs has colormap", procName, 1);
1645 L_INFO(
"pixm not defined\n", procName);
1648 if (pixGetDepth(pixm) != 1)
1649 return ERROR_INT(
"pixm not 1 bpp", procName, 1);
1652 L_INFO(
"pixm has no fg pixels; nothing to do\n", procName);
1658 for (i = 0; i < n; i++) {
1660 L_WARNING(
"missing pixmc!\n", procName);
1717 pixGetForegroundGrayMap(
PIX *pixs,
1724 l_int32 w, h, d, wd, hd;
1725 l_int32 empty, fgpixels;
1726 PIX *pixd, *piximi, *pixim2, *pixims, *pixs2, *pixb, *pixt1, *pixt2, *pixt3;
1728 PROCNAME(
"pixGetForegroundGrayMap");
1731 return ERROR_INT(
"&pixd not defined", procName, 1);
1734 return ERROR_INT(
"pixs not defined", procName, 1);
1737 return ERROR_INT(
"pixs not 8 bpp", procName, 1);
1738 if (pixim && pixGetDepth(pixim) != 1)
1739 return ERROR_INT(
"pixim not 1 bpp", procName, 1);
1740 if (sx < 2 || sy < 2)
1741 return ERROR_INT(
"sx and sy must be >= 2", procName, 1);
1744 wd = (w + sx - 1) / sx;
1745 hd = (h + sy - 1) / sy;
1765 if (pixim && fgpixels) {
1834 l_int32 w, h, wplsm, wpld, i, j;
1836 l_uint32 *datasm, *datad, *linesm, *lined;
1839 PROCNAME(
"pixGetInvBackgroundMap");
1841 if (!pixs || pixGetDepth(pixs) != 8)
1842 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", procName, NULL);
1843 if (pixGetColormap(pixs))
1844 return (
PIX *)ERROR_PTR(
"pixs has colormap", procName, NULL);
1847 return (
PIX *)ERROR_PTR(
"w and h must be >= 5", procName, NULL);
1852 wplsm = pixGetWpl(pixsm);
1857 wpld = pixGetWpl(pixd);
1858 for (i = 0; i < h; i++) {
1859 linesm = datasm + i * wplsm;
1860 lined = datad + i * wpld;
1861 for (j = 0; j < w; j++) {
1864 val16 = (256 * bgval) / val;
1866 L_WARNING(
"smoothed bg has 0 pixel!\n", procName);
1874 pixCopyResolution(pixd, pixs);
1897 l_int32 w, h, wm, hm, wpls, wpld, i, j, k, m, xoff, yoff;
1900 l_uint32 *datas, *datad, *lines, *lined, *flines, *flined;
1903 PROCNAME(
"pixApplyInvBackgroundGrayMap");
1905 if (!pixs || pixGetDepth(pixs) != 8)
1906 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", procName, NULL);
1907 if (pixGetColormap(pixs))
1908 return (
PIX *)ERROR_PTR(
"pixs has colormap", procName, NULL);
1909 if (!pixm || pixGetDepth(pixm) != 16)
1910 return (
PIX *)ERROR_PTR(
"pixm undefined or not 16 bpp", procName, NULL);
1911 if (sx == 0 || sy == 0)
1912 return (
PIX *)ERROR_PTR(
"invalid sx and/or sy", procName, NULL);
1915 wpls = pixGetWpl(pixs);
1919 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
1921 wpld = pixGetWpl(pixd);
1922 for (i = 0; i < hm; i++) {
1923 lines = datas + sy * i * wpls;
1924 lined = datad + sy * i * wpld;
1926 for (j = 0; j < wm; j++) {
1929 for (k = 0; k < sy && yoff + k < h; k++) {
1930 flines = lines + k * wpls;
1931 flined = lined + k * wpld;
1932 for (m = 0; m < sx && xoff + m < w; m++) {
1934 vald = (vals * val16) / 256;
1935 vald = L_MIN(vald, 255);
1965 l_int32 w, h, wm, hm, wpls, wpld, i, j, k, m, xoff, yoff;
1966 l_int32 rvald, gvald, bvald;
1968 l_uint32 rval16, gval16, bval16;
1969 l_uint32 *datas, *datad, *lines, *lined, *flines, *flined;
1972 PROCNAME(
"pixApplyInvBackgroundRGBMap");
1975 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
1976 if (pixGetDepth(pixs) != 32)
1977 return (
PIX *)ERROR_PTR(
"pixs not 32 bpp", procName, NULL);
1978 if (!pixmr || !pixmg || !pixmb)
1979 return (
PIX *)ERROR_PTR(
"pix maps not all defined", procName, NULL);
1980 if (pixGetDepth(pixmr) != 16 || pixGetDepth(pixmg) != 16 ||
1981 pixGetDepth(pixmb) != 16)
1982 return (
PIX *)ERROR_PTR(
"pix maps not all 16 bpp", procName, NULL);
1983 if (sx == 0 || sy == 0)
1984 return (
PIX *)ERROR_PTR(
"invalid sx and/or sy", procName, NULL);
1987 wpls = pixGetWpl(pixs);
1988 w = pixGetWidth(pixs);
1989 h = pixGetHeight(pixs);
1990 wm = pixGetWidth(pixmr);
1991 hm = pixGetHeight(pixmr);
1993 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
1995 wpld = pixGetWpl(pixd);
1996 for (i = 0; i < hm; i++) {
1997 lines = datas + sy * i * wpls;
1998 lined = datad + sy * i * wpld;
2000 for (j = 0; j < wm; j++) {
2005 for (k = 0; k < sy && yoff + k < h; k++) {
2006 flines = lines + k * wpls;
2007 flined = lined + k * wpld;
2008 for (m = 0; m < sx && xoff + m < w; m++) {
2009 vals = *(flines + xoff + m);
2010 rvald = ((vals >> 24) * rval16) / 256;
2011 rvald = L_MIN(rvald, 255);
2012 gvald = (((vals >> 16) & 0xff) * gval16) / 256;
2013 gvald = L_MIN(gvald, 255);
2014 bvald = (((vals >> 8) & 0xff) * bval16) / 256;
2015 bvald = L_MIN(bvald, 255);
2060 l_int32 i, j, w, h, d, wpls, wplg, wpld, vals, valg, vald;
2062 l_uint32 *datas, *datag, *datad, *lines, *lineg, *lined;
2066 PROCNAME(
"pixApplyVariableGrayMap");
2069 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
2071 return (
PIX *)ERROR_PTR(
"pixg not defined", procName, NULL);
2073 return (
PIX *)ERROR_PTR(
"pix sizes not equal", procName, NULL);
2076 return (
PIX *)ERROR_PTR(
"depth not 8 bpp", procName, NULL);
2086 if (w * h > 100000) {
2087 if ((lut = (l_uint8 *)LEPT_CALLOC(0x10000,
sizeof(l_uint8))) == NULL)
2088 return (
PIX *)ERROR_PTR(
"lut not made", procName, NULL);
2089 for (i = 0; i < 256; i++) {
2090 for (j = 0; j < 256; j++) {
2091 fval = (l_float32)(i * target) / (j + 0.5);
2092 lut[(i << 8) + j] = L_MIN(255, (l_int32)(fval + 0.5));
2099 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
2101 pixCopyResolution(pixd, pixs);
2103 wpld = pixGetWpl(pixd);
2105 wpls = pixGetWpl(pixs);
2107 wplg = pixGetWpl(pixg);
2108 for (i = 0; i < h; i++) {
2109 lines = datas + i * wpls;
2110 lineg = datag + i * wplg;
2111 lined = datad + i * wpld;
2113 for (j = 0; j < w; j++) {
2116 vald = lut[(vals << 8) + valg];
2121 for (j = 0; j < w; j++) {
2124 fval = (l_float32)(vals * target) / (valg + 0.5);
2125 vald = L_MIN(255, (l_int32)(fval + 0.5));
2181 l_int32 w, h, d, i, j, ncolors, rv, gv, bv, wpl;
2182 l_int32 *rarray, *garray, *barray;
2183 l_uint32 *data, *line;
2184 NUMA *nar, *nag, *nab;
2187 PROCNAME(
"pixGlobalNormRGB");
2190 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
2191 cmap = pixGetColormap(pixs);
2193 if (!cmap && d != 32)
2194 return (
PIX *)ERROR_PTR(
"pixs not cmapped or 32 bpp", procName, NULL);
2196 L_WARNING(
"mapval must be > 0; setting to 255\n", procName);
2201 if ((pixd =
pixCopy(pixd, pixs)) == NULL)
2202 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
2206 nar =
numaGammaTRC(1.0, 0, L_MAX(1, 255 * rval / mapval));
2207 nag =
numaGammaTRC(1.0, 0, L_MAX(1, 255 * gval / mapval));
2208 nab =
numaGammaTRC(1.0, 0, L_MAX(1, 255 * bval / mapval));
2214 if (!nar || !nag || !nab || !rarray || !garray || !barray) {
2215 L_ERROR(
"allocation failure in arrays\n", procName);
2216 goto cleanup_arrays;
2221 for (i = 0; i < ncolors; i++) {
2228 wpl = pixGetWpl(pixd);
2229 for (i = 0; i < h; i++) {
2230 line = data + i * wpl;
2231 for (j = 0; j < w; j++) {
2292 l_float32 rankrval, rankgval, rankbval;
2293 l_float32 rfract, gfract, bfract, maxfract;
2295 PROCNAME(
"pixGlobalNormNoSatRGB");
2298 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
2299 if (pixGetDepth(pixs) != 32)
2300 return (
PIX *)ERROR_PTR(
"pixs not 32 bpp", procName, NULL);
2302 return (
PIX *)ERROR_PTR(
"sampling factor < 1", procName, NULL);
2303 if (rank < 0.0 || rank > 1.0)
2304 return (
PIX *)ERROR_PTR(
"rank not in [0.0 ... 1.0]", procName, NULL);
2305 if (rval <= 0 || gval <= 0 || bval <= 0)
2306 return (
PIX *)ERROR_PTR(
"invalid estim. color values", procName, NULL);
2319 &rankgval, &rankbval);
2320 rfract = rankrval / (l_float32)rval;
2321 gfract = rankgval / (l_float32)gval;
2322 bfract = rankbval / (l_float32)bval;
2323 maxfract = L_MAX(rfract, gfract);
2324 maxfract = L_MAX(maxfract, bfract);
2326 fprintf(stderr,
"rankrval = %7.2f, rankgval = %7.2f, rankbval = %7.2f\n",
2327 rankrval, rankgval, rankbval);
2328 fprintf(stderr,
"rfract = %7.4f, gfract = %7.4f, bfract = %7.4f\n",
2329 rfract, gfract, bfract);
2332 mapval = (l_int32)(255. / maxfract);
2391 l_int32 targetthresh,
2396 PIX *pixe, *pixet, *pixsd, *pixg1, *pixg2, *pixth;
2398 PROCNAME(
"pixThresholdSpreadNorm");
2400 if (ppixth) *ppixth = NULL;
2401 if (ppixb) *ppixb = NULL;
2402 if (ppixd) *ppixd = NULL;
2403 if (!pixs || pixGetDepth(pixs) != 8)
2404 return ERROR_INT(
"pixs not defined or not 8 bpp", procName, 1);
2405 if (pixGetColormap(pixs))
2406 return ERROR_INT(
"pixs is colormapped", procName, 1);
2407 if (!ppixth && !ppixb && !ppixd)
2408 return ERROR_INT(
"no output requested", procName, 1);
2410 return ERROR_INT(
"invalid filter type", procName, 1);
2431 pixth =
pixGammaTRC(NULL, pixg2, gamma, minval, maxval);
2496 l_float32 scalex, scaley;
2497 PIX *pixt, *pixsd, *pixmin, *pixbg, *pixbgi, *pixd;
2499 PROCNAME(
"pixBackgroundNormFlex");
2501 if (!pixs || pixGetDepth(pixs) != 8)
2502 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", procName, NULL);
2503 if (pixGetColormap(pixs))
2504 return (
PIX *)ERROR_PTR(
"pixs is colormapped", procName, NULL);
2505 if (sx < 3 || sy < 3)
2506 return (
PIX *)ERROR_PTR(
"sx and/or sy less than 3", procName, NULL);
2507 if (sx > 10 || sy > 10)
2508 return (
PIX *)ERROR_PTR(
"sx and/or sy exceed 10", procName, NULL);
2509 if (smoothx < 1 || smoothy < 1)
2510 return (
PIX *)ERROR_PTR(
"smooth params less than 1", procName, NULL);
2511 if (smoothx > 3 || smoothy > 3)
2512 return (
PIX *)ERROR_PTR(
"smooth params exceed 3", procName, NULL);
2515 scalex = 1. / (l_float32)sx;
2516 scaley = 1. / (l_float32)sy;
2592 PIX *pixmin, *pixmax;
2594 PROCNAME(
"pixContrastNorm");
2596 if (!pixs || pixGetDepth(pixs) != 8)
2597 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", procName, pixd);
2598 if (pixd && pixd != pixs)
2599 return (
PIX *)ERROR_PTR(
"pixd not null or == pixs", procName, pixd);
2600 if (pixGetColormap(pixs))
2601 return (
PIX *)ERROR_PTR(
"pixs is colormapped", procName, pixd);
2602 if (sx < 5 || sy < 5)
2603 return (
PIX *)ERROR_PTR(
"sx and/or sy less than 5", procName, pixd);
2604 if (smoothx < 0 || smoothy < 0)
2605 return (
PIX *)ERROR_PTR(
"smooth params less than 0", procName, pixd);
2606 if (smoothx > 8 || smoothy > 8)
2607 return (
PIX *)ERROR_PTR(
"smooth params exceed 8", procName, pixd);
2611 pixMinMaxTiles(pixs, sx, sy, mindiff, smoothx, smoothy, &pixmin, &pixmax);
2654 PIX *pixmin1, *pixmax1, *pixmin2, *pixmax2;
2656 PROCNAME(
"pixMinMaxTiles");
2658 if (ppixmin) *ppixmin = NULL;
2659 if (ppixmax) *ppixmax = NULL;
2660 if (!ppixmin || !ppixmax)
2661 return ERROR_INT(
"&pixmin or &pixmax undefined", procName, 1);
2662 if (!pixs || pixGetDepth(pixs) != 8)
2663 return ERROR_INT(
"pixs undefined or not 8 bpp", procName, 1);
2664 if (pixGetColormap(pixs))
2665 return ERROR_INT(
"pixs is colormapped", procName, 1);
2666 if (sx < 5 || sy < 5)
2667 return ERROR_INT(
"sx and/or sy less than 3", procName, 1);
2668 if (smoothx < 0 || smoothy < 0)
2669 return ERROR_INT(
"smooth params less than 0", procName, 1);
2670 if (smoothx > 5 || smoothy > 5)
2671 return ERROR_INT(
"smooth params exceed 5", procName, 1);
2695 if (smoothx > 0 || smoothy > 0) {
2696 smoothx = L_MIN(smoothx, (w - 1) / 2);
2697 smoothy = L_MIN(smoothy, (h - 1) / 2);
2705 pixCopyResolution(*ppixmin, pixs);
2706 pixCopyResolution(*ppixmax, pixs);
2739 l_int32 i, j, w, h, d, wpl, val1, val2, found;
2740 l_uint32 *data1, *data2, *line1, *line2;
2742 PROCNAME(
"pixSetLowContrast");
2744 if (!pixs1 || !pixs2)
2745 return ERROR_INT(
"pixs1 and pixs2 not both defined", procName, 1);
2747 return ERROR_INT(
"pixs1 and pixs2 not equal size", procName, 1);
2750 return ERROR_INT(
"depth not 8 bpp", procName, 1);
2751 if (mindiff > 254)
return 0;
2755 wpl = pixGetWpl(pixs1);
2757 for (i = 0; i < h; i++) {
2758 line1 = data1 + i * wpl;
2759 line2 = data2 + i * wpl;
2760 for (j = 0; j < w; j++) {
2763 if (L_ABS(val1 - val2) >= mindiff) {
2771 L_WARNING(
"no pixel pair diffs as large as mindiff\n", procName);
2777 for (i = 0; i < h; i++) {
2778 line1 = data1 + i * wpl;
2779 line2 = data2 + i * wpl;
2780 for (j = 0; j < w; j++) {
2783 if (L_ABS(val1 - val2) < mindiff) {
2825 l_int32 i, j, k, m, w, h, wt, ht, wpl, wplt, xoff, yoff;
2826 l_int32 minval, maxval, val, sval;
2829 l_uint32 *data, *datamin, *datamax, *line, *tline, *linemin, *linemax;
2831 PROCNAME(
"pixLinearTRCTiled");
2833 if (!pixs || pixGetDepth(pixs) != 8)
2834 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", procName, pixd);
2835 if (pixd && pixd != pixs)
2836 return (
PIX *)ERROR_PTR(
"pixd not null or == pixs", procName, pixd);
2837 if (pixGetColormap(pixs))
2838 return (
PIX *)ERROR_PTR(
"pixs is colormapped", procName, pixd);
2839 if (!pixmin || !pixmax)
2840 return (
PIX *)ERROR_PTR(
"pixmin & pixmax not defined", procName, pixd);
2841 if (sx < 5 || sy < 5)
2842 return (
PIX *)ERROR_PTR(
"sx and/or sy less than 5", procName, pixd);
2844 if ((iaa = (l_int32 **)LEPT_CALLOC(256,
sizeof(l_int32 *))) == NULL)
2845 return (
PIX *)ERROR_PTR(
"iaa not made", procName, NULL);
2846 if ((pixd =
pixCopy(pixd, pixs)) == NULL) {
2848 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
2853 wpl = pixGetWpl(pixd);
2856 wplt = pixGetWpl(pixmin);
2858 for (i = 0; i < ht; i++) {
2859 line = data + sy * i * wpl;
2860 linemin = datamin + i * wplt;
2861 linemax = datamax + i * wplt;
2863 for (j = 0; j < wt; j++) {
2867 if (maxval == minval) {
2873 L_ERROR(
"failure to make ia for j = %d!\n", procName, j);
2876 for (k = 0; k < sy && yoff + k < h; k++) {
2877 tline = line + k * wpl;
2878 for (m = 0; m < sx && xoff + m < w; m++) {
2880 sval = val - minval;
2881 sval = L_MAX(0, sval);
2888 for (i = 0; i < 256; i++)
2912 PROCNAME(
"iaaGetLinearTRC");
2915 return (l_int32 *)ERROR_PTR(
"iaa not defined", procName, NULL);
2917 if (iaa[diff] != NULL)
2920 if ((ia = (l_int32 *)LEPT_CALLOC(256,
sizeof(l_int32))) == NULL)
2921 return (l_int32 *)ERROR_PTR(
"ia not made", procName, NULL);
2924 for (i = 0; i < 256; i++)
2928 factor = 255. / (l_float32)diff;
2929 for (i = 0; i < diff + 1; i++)
2930 ia[i] = (l_int32)(factor * i + 0.5);
2931 for (i = diff + 1; i < 256; i++)
l_int32 pixGetBackgroundRGBMap(PIX *pixs, PIX *pixim, PIX *pixg, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, PIX **ppixmr, PIX **ppixmg, PIX **ppixmb)
pixGetBackgroundRGBMap()
PIX * pixApplyInvBackgroundGrayMap(PIX *pixs, PIX *pixm, l_int32 sx, l_int32 sy)
pixApplyInvBackgroundGrayMap()
static l_int32 * iaaGetLinearTRC(l_int32 **iaa, l_int32 diff)
iaaGetLinearTRC()
l_int32 numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
PIX * pixSeedspread(PIX *pixs, l_int32 connectivity)
pixSeedspread()
static const l_int32 DEFAULT_Y_SMOOTH_SIZE
PIX * pixApplyVariableGrayMap(PIX *pixs, PIX *pixg, l_int32 target)
pixApplyVariableGrayMap()
PIX * pixScaleRGBToGrayFast(PIX *pixs, l_int32 factor, l_int32 color)
pixScaleRGBToGrayFast()
l_int32 pixGetRankValueMaskedRGB(PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor, l_float32 rank, l_float32 *prval, l_float32 *pgval, l_float32 *pbval)
pixGetRankValueMaskedRGB()
l_int32 pixGetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 *pval)
pixGetPixel()
PIX * pixScaleGrayMinMax(PIX *pixs, l_int32 xfact, l_int32 yfact, l_int32 type)
pixScaleGrayMinMax()
l_int32 pixZero(PIX *pix, l_int32 *pempty)
pixZero()
NUMA * numaGammaTRC(l_float32 gamma, l_int32 minval, l_int32 maxval)
numaGammaTRC()
l_int32 pixGetBackgroundGrayMap(PIX *pixs, PIX *pixim, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, PIX **ppixd)
pixGetBackgroundGrayMap()
PIX * pixCloseGray(PIX *pixs, l_int32 hsize, l_int32 vsize)
pixCloseGray()
l_int32 pixMinMaxTiles(PIX *pixs, l_int32 sx, l_int32 sy, l_int32 mindiff, l_int32 smoothx, l_int32 smoothy, PIX **ppixmin, PIX **ppixmax)
pixMinMaxTiles()
l_int32 pixBackgroundNormGrayArrayMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval, PIX **ppixd)
pixBackgroundNormGrayArrayMorph()
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
l_int32 pixSetLowContrast(PIX *pixs1, PIX *pixs2, l_int32 mindiff)
pixSetLowContrast()
static const l_int32 DEFAULT_MIN_COUNT
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
PIX * pixInvert(PIX *pixd, PIX *pixs)
pixInvert()
l_int32 pixBackgroundNormRGBArrays(PIX *pixs, PIX *pixim, PIX *pixg, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, l_int32 bgval, l_int32 smoothx, l_int32 smoothy, PIX **ppixr, PIX **ppixg, PIX **ppixb)
pixBackgroundNormRGBArrays()
NUMA * numaCreate(l_int32 n)
numaCreate()
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
l_uint32 * pixGetData(PIX *pix)
pixGetData()
l_int32 pixcmapGetColor(PIXCMAP *cmap, l_int32 index, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
pixcmapGetColor()
PIX * pixThresholdToBinary(PIX *pixs, l_int32 thresh)
pixThresholdToBinary()
PIX * pixScaleBySampling(PIX *pixs, l_float32 scalex, l_float32 scaley)
pixScaleBySampling()
l_int32 pixSmoothConnectedRegions(PIX *pixs, PIX *pixm, l_int32 factor)
pixSmoothConnectedRegions()
l_int32 boxaGetBoxGeometry(BOXA *boxa, l_int32 index, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxaGetBoxGeometry()
#define GET_DATA_BIT(pdata, n)
PIX * pixCreateTemplate(PIX *pixs)
pixCreateTemplate()
PIX * pixTwoSidedEdgeFilter(PIX *pixs, l_int32 orientflag)
pixTwoSidedEdgeFilter()
l_int32 * numaGetIArray(NUMA *na)
numaGetIArray()
l_int32 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()
PIX * pixConvertRGBToGrayFast(PIX *pixs)
pixConvertRGBToGrayFast()
BOXA * pixConnComp(PIX *pixs, PIXA **ppixa, l_int32 connectivity)
pixConnComp()
l_int32 pixThresholdSpreadNorm(PIX *pixs, l_int32 filtertype, l_int32 edgethresh, l_int32 smoothx, l_int32 smoothy, l_float32 gamma, l_int32 minval, l_int32 maxval, l_int32 targetthresh, PIX **ppixth, PIX **ppixb, PIX **ppixd)
pixThresholdSpreadNorm()
PIX * pixBackgroundNormFlex(PIX *pixs, l_int32 sx, l_int32 sy, l_int32 smoothx, l_int32 smoothy, l_int32 delta)
pixBackgroundNormFlex()
PIX * pixLinearTRCTiled(PIX *pixd, PIX *pixs, l_int32 sx, l_int32 sy, PIX *pixmin, PIX *pixmax)
pixLinearTRCTiled()
PIX * pixGetInvBackgroundMap(PIX *pixs, l_int32 bgval, l_int32 smoothx, l_int32 smoothy)
pixGetInvBackgroundMap()
PIX * pixCleanBackgroundToWhite(PIX *pixs, PIX *pixim, PIX *pixg, l_float32 gamma, l_int32 blackval, l_int32 whiteval)
pixCleanBackgroundToWhite()
PIX * pixAnd(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixAnd()
static const l_int32 DEFAULT_TILE_HEIGHT
l_int32 pixAddConstantGray(PIX *pixs, l_int32 val)
pixAddConstantGray()
PIX * pixMorphSequence(PIX *pixs, const char *sequence, l_int32 dispsep)
pixMorphSequence()
l_int32 pixLocalExtrema(PIX *pixs, l_int32 maxmin, l_int32 minmax, PIX **ppixmin, PIX **ppixmax)
pixLocalExtrema()
l_int32 pixClearAll(PIX *pix)
pixClearAll()
PIX * pixContrastNorm(PIX *pixd, PIX *pixs, l_int32 sx, l_int32 sy, l_int32 mindiff, l_int32 smoothx, l_int32 smoothy)
pixContrastNorm()
#define SET_DATA_BYTE(pdata, n, val)
l_int32 pixSizesEqual(PIX *pix1, PIX *pix2)
pixSizesEqual()
#define GET_DATA_BYTE(pdata, n)
l_int32 pixGetBackgroundRGBMapMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, PIX **ppixmr, PIX **ppixmg, PIX **ppixmb)
pixGetBackgroundRGBMapMorph()
PIX * pixApplyInvBackgroundRGBMap(PIX *pixs, PIX *pixmr, PIX *pixmg, PIX *pixmb, l_int32 sx, l_int32 sy)
pixApplyInvBackgroundRGBMap()
PIX * pixExtendByReplication(PIX *pixs, l_int32 addw, l_int32 addh)
pixExtendByReplication()
PIX * pixCreateNoInit(l_int32 width, l_int32 height, l_int32 depth)
pixCreateNoInit()
PIX * pixClone(PIX *pixs)
pixClone()
static const l_int32 DEFAULT_BG_VAL
void pixDestroy(PIX **ppix)
pixDestroy()
l_int32 pixCombineMasked(PIX *pixd, PIX *pixs, PIX *pixm)
pixCombineMasked()
l_int32 pixBackgroundNormGrayArray(PIX *pixs, PIX *pixim, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, l_int32 bgval, l_int32 smoothx, l_int32 smoothy, PIX **ppixd)
pixBackgroundNormGrayArray()
l_int32 pixPaintThroughMask(PIX *pixd, PIX *pixm, l_int32 x, l_int32 y, l_uint32 val)
pixPaintThroughMask()
void numaDestroy(NUMA **pna)
numaDestroy()
static const l_int32 DEFAULT_TILE_WIDTH
l_int32 pixBackgroundNormRGBArraysMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval, PIX **ppixr, PIX **ppixg, PIX **ppixb)
pixBackgroundNormRGBArraysMorph()
l_int32 pixGetBackgroundGrayMapMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, PIX **ppixm)
pixGetBackgroundGrayMapMorph()
PIX * pixReduceBinary2(PIX *pixs, l_uint8 *intab)
pixReduceBinary2()
static const l_int32 DEFAULT_X_SMOOTH_SIZE
l_int32 pixSetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 val)
pixSetPixel()
PIX * pixExpandReplicate(PIX *pixs, l_int32 factor)
pixExpandReplicate()
l_int32 pixcmapResetColor(PIXCMAP *cmap, l_int32 index, l_int32 rval, l_int32 gval, l_int32 bval)
pixcmapResetColor()
PIX * pixaGetPix(PIXA *pixa, l_int32 index, l_int32 accesstype)
pixaGetPix()
PIX * pixBackgroundNorm(PIX *pixs, PIX *pixim, PIX *pixg, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, l_int32 bgval, l_int32 smoothx, l_int32 smoothy)
pixBackgroundNorm()
l_int32 composeRGBPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *ppixel)
composeRGBPixel()
l_int32 pixFillMapHoles(PIX *pix, l_int32 nx, l_int32 ny, l_int32 filltype)
pixFillMapHoles()
static const l_int32 DEFAULT_FG_THRESHOLD
l_int32 pixcmapGetCount(PIXCMAP *cmap)
pixcmapGetCount()
PIX * pixBackgroundNormSimple(PIX *pixs, PIX *pixim, PIX *pixg)
pixBackgroundNormSimple()
PIX * pixSobelEdgeFilter(PIX *pixs, l_int32 orientflag)
pixSobelEdgeFilter()
PIX * pixCopy(PIX *pixd, PIX *pixs)
pixCopy()
PIX * pixGammaTRC(PIX *pixd, PIX *pixs, l_float32 gamma, l_int32 minval, l_int32 maxval)
pixGammaTRC()
PIX * pixBlockconv(PIX *pix, l_int32 wc, l_int32 hc)
pixBlockconv()
PIX * pixBackgroundNormMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval)
pixBackgroundNormMorph()
l_int32 boxaGetCount(BOXA *boxa)
boxaGetCount()
l_int32 numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_int32 pixGetDimensions(PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
PIX * pixScaleSmooth(PIX *pix, l_float32 scalex, l_float32 scaley)
pixScaleSmooth()
PIX * pixVarThresholdToBinary(PIX *pixs, PIX *pixg)
pixVarThresholdToBinary()
PIX * pixGlobalNormRGB(PIX *pixd, PIX *pixs, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 mapval)
pixGlobalNormRGB()
PIX * pixScale(PIX *pixs, l_float32 scalex, l_float32 scaley)
pixScale()
#define SET_DATA_TWO_BYTES(pdata, n, val)
void pixaDestroy(PIXA **ppixa)
pixaDestroy()
void extractRGBValues(l_uint32 pixel, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
extractRGBValues()
PIX * pixSeedfillGrayBasin(PIX *pixb, PIX *pixm, l_int32 delta, l_int32 connectivity)
pixSeedfillGrayBasin()
PIX * pixGlobalNormNoSatRGB(PIX *pixd, PIX *pixs, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 factor, l_float32 rank)
pixGlobalNormNoSatRGB()
l_int32 pixGetAverageMasked(PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor, l_int32 type, l_float32 *pval)
pixGetAverageMasked()