135 #include <config_auto.h>
138 #include "allheaders.h"
157 l_int32 mindiff, l_int32 smoothx, l_int32 smoothy,
158 PIX **ppixmin,
PIX **ppixmax);
161 PIX *pixmin,
PIX *pixmax);
164 #ifndef NO_CONSOLE_IO
165 #define DEBUG_GLOBAL 0
207 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
208 d = pixGetDepth(pixs);
209 if (d != 8 && d != 32)
210 return (
PIX *)ERROR_PTR(
"depth not 8 or 32", __func__, NULL);
211 if (whiteval > 200) {
212 L_WARNING(
"white value %d must not exceed 200; reset to 190",
219 return (
PIX *)ERROR_PTR(
"background norm failedd", __func__, NULL);
220 pixGammaTRC(pixd, pixd, gamma, blackval, whiteval);
332 PIX *pixm, *pixmi, *pixd;
333 PIX *pixmr, *pixmg, *pixmb, *pixmri, *pixmgi, *pixmbi;
336 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
337 d = pixGetDepth(pixs);
338 if (d != 8 && d != 32)
339 return (
PIX *)ERROR_PTR(
"pixs not 8 or 32 bpp", __func__, NULL);
340 if (sx < 4 || sy < 4)
341 return (
PIX *)ERROR_PTR(
"sx and sy must be >= 4", __func__, NULL);
342 if (mincount > sx * sy) {
343 L_WARNING(
"mincount too large for tile size\n", __func__);
344 mincount = (sx * sy) / 3;
353 return (
PIX *)ERROR_PTR(
"pixim all foreground", __func__, NULL);
361 L_WARNING(
"map not made; return a copy of the source\n", __func__);
367 L_WARNING(
"pixmi not made; return a copy of source\n", __func__);
378 pixmr = pixmg = pixmb = NULL;
380 mincount, &pixmr, &pixmg, &pixmb);
381 if (!pixmr || !pixmg || !pixmb) {
385 L_WARNING(
"map not made; return a copy of the source\n", __func__);
392 if (!pixmri || !pixmgi || !pixmbi) {
393 L_WARNING(
"not all pixm*i are made; return src copy\n", __func__);
409 ERROR_PTR(
"pixd not made", __func__, NULL);
410 pixCopyResolution(pixd, pixs);
462 PIX *pixm, *pixmi, *pixd;
463 PIX *pixmr, *pixmg, *pixmb, *pixmri, *pixmgi, *pixmbi;
466 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
467 d = pixGetDepth(pixs);
468 if (d != 8 && d != 32)
469 return (
PIX *)ERROR_PTR(
"pixs not 8 or 32 bpp", __func__, NULL);
470 if (reduction < 2 || reduction > 16)
471 return (
PIX *)ERROR_PTR(
"reduction must be between 2 and 16",
480 return (
PIX *)ERROR_PTR(
"pixim all foreground", __func__, NULL);
487 return (
PIX *)ERROR_PTR(
"pixm not made", __func__, NULL);
490 ERROR_PTR(
"pixmi not made", __func__, NULL);
493 reduction, reduction);
498 pixmr = pixmg = pixmb = NULL;
500 &pixmr, &pixmg, &pixmb);
501 if (!pixmr || !pixmg || !pixmb) {
505 return (
PIX *)ERROR_PTR(
"not all pixm*", __func__, NULL);
511 if (!pixmri || !pixmgi || !pixmbi)
512 ERROR_PTR(
"not all pixm*i are made", __func__, NULL);
515 reduction, reduction);
526 ERROR_PTR(
"pixd not made", __func__, NULL);
527 pixCopyResolution(pixd, pixs);
579 return ERROR_INT(
"&pixd not defined", __func__, 1);
581 if (!pixs || pixGetDepth(pixs) != 8)
582 return ERROR_INT(
"pixs not defined or not 8 bpp", __func__, 1);
583 if (pixGetColormap(pixs))
584 return ERROR_INT(
"pixs is colormapped", __func__, 1);
585 if (pixim && pixGetDepth(pixim) != 1)
586 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
587 if (sx < 4 || sy < 4)
588 return ERROR_INT(
"sx and sy must be >= 4", __func__, 1);
589 if (mincount > sx * sy) {
590 L_WARNING(
"mincount too large for tile size\n", __func__);
591 mincount = (sx * sy) / 3;
600 return ERROR_INT(
"pixim all foreground", __func__, 1);
605 return ERROR_INT(
"pixm not made", __func__, 1);
607 pixCopyResolution(*ppixd, pixs);
654 PIX *pixmr, *pixmg, *pixmb;
656 if (!ppixr || !ppixg || !ppixb)
657 return ERROR_INT(
"&pixr, &pixg, &pixb not all defined", __func__, 1);
658 *ppixr = *ppixg = *ppixb = NULL;
660 return ERROR_INT(
"pixs not defined", __func__, 1);
661 if (pixGetDepth(pixs) != 32)
662 return ERROR_INT(
"pixs not 32 bpp", __func__, 1);
663 if (pixim && pixGetDepth(pixim) != 1)
664 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
665 if (sx < 4 || sy < 4)
666 return ERROR_INT(
"sx and sy must be >= 4", __func__, 1);
667 if (mincount > sx * sy) {
668 L_WARNING(
"mincount too large for tile size\n", __func__);
669 mincount = (sx * sy) / 3;
678 return ERROR_INT(
"pixim all foreground", __func__, 1);
682 &pixmr, &pixmg, &pixmb);
683 if (!pixmr || !pixmg || !pixmb) {
687 return ERROR_INT(
"not all pixm* made", __func__, 1);
731 return ERROR_INT(
"&pixd not defined", __func__, 1);
734 return ERROR_INT(
"pixs not defined", __func__, 1);
735 if (pixGetDepth(pixs) != 8)
736 return ERROR_INT(
"pixs not 8 bpp", __func__, 1);
737 if (pixim && pixGetDepth(pixim) != 1)
738 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
739 if (reduction < 2 || reduction > 16)
740 return ERROR_INT(
"reduction must be between 2 and 16", __func__, 1);
748 return ERROR_INT(
"pixim all foreground", __func__, 1);
753 return ERROR_INT(
"pixm not made", __func__, 1);
755 pixCopyResolution(*ppixd, pixs);
793 PIX *pixmr, *pixmg, *pixmb;
795 if (!ppixr || !ppixg || !ppixb)
796 return ERROR_INT(
"&pixr, &pixg, &pixb not all defined", __func__, 1);
797 *ppixr = *ppixg = *ppixb = NULL;
799 return ERROR_INT(
"pixs not defined", __func__, 1);
800 if (pixGetDepth(pixs) != 32)
801 return ERROR_INT(
"pixs not 32 bpp", __func__, 1);
802 if (pixim && pixGetDepth(pixim) != 1)
803 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
804 if (reduction < 2 || reduction > 16)
805 return ERROR_INT(
"reduction must be between 2 and 16", __func__, 1);
813 return ERROR_INT(
"pixim all foreground", __func__, 1);
817 &pixmr, &pixmg, &pixmb);
818 if (!pixmr || !pixmg || !pixmb) {
822 return ERROR_INT(
"not all pixm* made", __func__, 1);
866 l_int32 w, h, wd, hd, wim, him, wpls, wplim, wpld, wplf;
867 l_int32 xim, yim, delx, nx, ny, i, j, k, m;
868 l_int32 count, sum, val8;
869 l_int32 empty, fgpixels;
870 l_uint32 *datas, *dataim, *datad, *dataf, *lines, *lineim, *lined, *linef;
871 l_float32 scalex, scaley;
872 PIX *pixd, *piximi, *pixb, *pixf, *pixims;
875 return ERROR_INT(
"&pixd not defined", __func__, 1);
877 if (!pixs || pixGetDepth(pixs) != 8)
878 return ERROR_INT(
"pixs not defined or not 8 bpp", __func__, 1);
879 if (pixGetColormap(pixs))
880 return ERROR_INT(
"pixs is colormapped", __func__, 1);
881 if (pixim && pixGetDepth(pixim) != 1)
882 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
883 if (sx < 4 || sy < 4)
884 return ERROR_INT(
"sx and sy must be >= 4", __func__, 1);
885 if (mincount > sx * sy) {
886 L_WARNING(
"mincount too large for tile size\n", __func__);
887 mincount = (sx * sy) / 3;
898 return ERROR_INT(
"pixim all fg; no background", __func__, 1);
911 return ERROR_INT(
"pixf not made", __func__, 1);
916 w = pixGetWidth(pixs);
917 h = pixGetHeight(pixs);
918 wd = (w + sx - 1) / sx;
919 hd = (h + sy - 1) / sy;
927 wpls = pixGetWpl(pixs);
929 wpld = pixGetWpl(pixd);
931 wplf = pixGetWpl(pixf);
933 for (i = 0; i < ny; i++) {
934 lines = datas + sy * i * wpls;
935 linef = dataf + sy * i * wplf;
936 lined = datad + i * wpld;
937 for (j = 0; j < nx; j++) {
941 for (k = 0; k < sy; k++) {
942 for (m = 0; m < sx; m++) {
949 if (count >= mincount) {
968 if (pixim && fgpixels) {
969 wim = pixGetWidth(pixim);
970 him = pixGetHeight(pixim);
972 wplim = pixGetWpl(pixim);
973 for (i = 0; i < ny; i++) {
974 yim = i * sy + sy / 2;
977 lineim = dataim + yim * wplim;
978 for (j = 0; j < nx; j++) {
979 xim = j * sx + sx / 2;
991 L_WARNING(
"can't make the map\n", __func__);
1000 if (pixim && fgpixels) {
1001 scalex = 1. / (l_float32)sx;
1002 scaley = 1. / (l_float32)sy;
1009 pixCopyResolution(*ppixd, pixs);
1049 l_int32 w, h, wm, hm, wim, him, wpls, wplim, wplf;
1050 l_int32 xim, yim, delx, nx, ny, i, j, k, m;
1051 l_int32 count, rsum, gsum, bsum, rval, gval, bval;
1052 l_int32 empty, fgpixels;
1054 l_uint32 *datas, *dataim, *dataf, *lines, *lineim, *linef;
1055 l_float32 scalex, scaley;
1056 PIX *piximi, *pixgc, *pixb, *pixf, *pixims;
1057 PIX *pixmr, *pixmg, *pixmb;
1059 if (!ppixmr || !ppixmg || !ppixmb)
1060 return ERROR_INT(
"&pixm* not all defined", __func__, 1);
1061 *ppixmr = *ppixmg = *ppixmb = NULL;
1063 return ERROR_INT(
"pixs not defined", __func__, 1);
1064 if (pixGetDepth(pixs) != 32)
1065 return ERROR_INT(
"pixs not 32 bpp", __func__, 1);
1066 if (pixim && pixGetDepth(pixim) != 1)
1067 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
1068 if (sx < 4 || sy < 4)
1069 return ERROR_INT(
"sx and sy must be >= 4", __func__, 1);
1070 if (mincount > sx * sy) {
1071 L_WARNING(
"mincount too large for tile size\n", __func__);
1072 mincount = (sx * sy) / 3;
1082 return ERROR_INT(
"pixim all fg; no background", __func__, 1);
1100 w = pixGetWidth(pixs);
1101 h = pixGetHeight(pixs);
1102 wm = (w + sx - 1) / sx;
1103 hm = (h + sy - 1) / sy;
1114 wpls = pixGetWpl(pixs);
1116 wplf = pixGetWpl(pixf);
1118 for (i = 0; i < ny; i++) {
1119 lines = datas + sy * i * wpls;
1120 linef = dataf + sy * i * wplf;
1121 for (j = 0; j < nx; j++) {
1123 rsum = gsum = bsum = 0;
1125 for (k = 0; k < sy; k++) {
1126 for (m = 0; m < sx; m++) {
1128 pixel = *(lines + k * wpls + delx + m);
1129 rsum += (pixel >> 24);
1130 gsum += ((pixel >> 16) & 0xff);
1131 bsum += ((pixel >> 8) & 0xff);
1136 if (count >= mincount) {
1137 rval = rsum / count;
1138 gval = gsum / count;
1139 bval = bsum / count;
1154 wim = pixGetWidth(pixim);
1155 him = pixGetHeight(pixim);
1157 wplim = pixGetWpl(pixim);
1158 for (i = 0; i < ny; i++) {
1159 yim = i * sy + sy / 2;
1162 lineim = dataim + yim * wplim;
1163 for (j = 0; j < nx; j++) {
1164 xim = j * sx + sx / 2;
1183 L_WARNING(
"can't make the maps\n", __func__);
1189 if (pixim && fgpixels) {
1190 scalex = 1. / (l_float32)sx;
1191 scaley = 1. / (l_float32)sy;
1202 pixCopyResolution(*ppixmr, pixs);
1203 pixCopyResolution(*ppixmg, pixs);
1204 pixCopyResolution(*ppixmb, pixs);
1227 l_int32 nx, ny, empty, fgpixels;
1229 PIX *pixm, *pix1, *pix2, *pix3, *pixims;
1232 return ERROR_INT(
"&pixm not defined", __func__, 1);
1234 if (!pixs || pixGetDepth(pixs) != 8)
1235 return ERROR_INT(
"pixs not defined or not 8 bpp", __func__, 1);
1236 if (pixGetColormap(pixs))
1237 return ERROR_INT(
"pixs is colormapped", __func__, 1);
1238 if (pixim && pixGetDepth(pixim) != 1)
1239 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
1247 return ERROR_INT(
"pixim all fg; no background", __func__, 1);
1255 scale = 1. / (l_float32)reduction;
1266 pixims =
pixScale(pixim, scale, scale);
1268 pixAnd(pixm, pixm, pix3);
1275 nx = pixGetWidth(pixs) / reduction;
1276 ny = pixGetHeight(pixs) / reduction;
1280 L_WARNING(
"can't make the map\n", __func__);
1286 if (pixim && fgpixels)
1291 pixCopyResolution(*ppixm, pixs);
1318 l_int32 nx, ny, empty, fgpixels;
1320 PIX *pixm, *pixmr, *pixmg, *pixmb, *pix1, *pix2, *pix3, *pixims;
1322 if (!ppixmr || !ppixmg || !ppixmb)
1323 return ERROR_INT(
"&pixm* not all defined", __func__, 1);
1324 *ppixmr = *ppixmg = *ppixmb = NULL;
1326 return ERROR_INT(
"pixs not defined", __func__, 1);
1327 if (pixGetDepth(pixs) != 32)
1328 return ERROR_INT(
"pixs not 32 bpp", __func__, 1);
1329 if (pixim && pixGetDepth(pixim) != 1)
1330 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
1338 return ERROR_INT(
"pixim all fg; no background", __func__, 1);
1346 scale = 1. / (l_float32)reduction;
1350 pixims =
pixScale(pixim, scale, scale);
1361 pixmr =
pixAnd(NULL, pixm, pix3);
1372 pixmg =
pixAnd(NULL, pixm, pix3);
1383 pixmb =
pixAnd(NULL, pixm, pix3);
1392 nx = pixGetWidth(pixs) / reduction;
1393 ny = pixGetHeight(pixs) / reduction;
1401 L_WARNING(
"can't make the maps\n", __func__);
1408 if (pixim && fgpixels) {
1418 pixCopyResolution(*ppixmr, pixs);
1419 pixCopyResolution(*ppixmg, pixs);
1420 pixCopyResolution(*ppixmb, pixs);
1467 l_int32 w, h, y, nmiss, goodcol, i, j, found, ival, valtest;
1468 l_uint32 val, lastval;
1471 if (!pix || pixGetDepth(pix) != 8)
1472 return ERROR_INT(
"pix not defined or not 8 bpp", __func__, 1);
1473 if (pixGetColormap(pix))
1474 return ERROR_INT(
"pix is colormapped", __func__, 1);
1481 for (j = 0; j < nx; j++) {
1483 for (i = 0; i < ny; i++) {
1485 if (val != valtest) {
1491 if (found == FALSE) {
1497 for (i = y - 1; i >= 0; i--)
1500 for (i = 1; i < h; i++) {
1512 L_WARNING(
"no bg found; no data in any column\n", __func__);
1520 for (j = 0; j < w; j++) {
1528 for (j = goodcol - 1; j >= 0; j--)
1531 for (j = goodcol + 1; j < w; j++) {
1570 if (!pixs || pixGetDepth(pixs) != 8)
1571 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
1573 if (addw == 0 && addh == 0)
1577 if ((pixd =
pixCreate(w + addw, h + addh, 8)) == NULL)
1578 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
1582 for (i = 0; i < h; i++) {
1584 for (j = 0; j < addw; j++)
1590 for (j = 0; j < w + addw; j++) {
1592 for (i = 0; i < addh; i++)
1597 pixCopyResolution(pixd, pixs);
1627 l_int32 empty, i, n, x, y;
1633 if (!pixs || pixGetDepth(pixs) != 8)
1634 return ERROR_INT(
"pixs not defined or not 8 bpp", __func__, 1);
1635 if (pixGetColormap(pixs))
1636 return ERROR_INT(
"pixs has colormap", __func__, 1);
1638 L_INFO(
"pixm not defined\n", __func__);
1641 if (pixGetDepth(pixm) != 1)
1642 return ERROR_INT(
"pixm not 1 bpp", __func__, 1);
1645 L_INFO(
"pixm has no fg pixels; nothing to do\n", __func__);
1651 for (i = 0; i < n; i++) {
1653 L_WARNING(
"missing pixmc!\n", __func__);
1710 pixGetForegroundGrayMap(
PIX *pixs,
1717 l_int32 w, h, d, wd, hd;
1718 l_int32 empty, fgpixels;
1719 PIX *pixd, *piximi, *pixim2, *pixims, *pixs2, *pixb, *pixt1, *pixt2, *pixt3;
1722 return ERROR_INT(
"&pixd not defined", __func__, 1);
1725 return ERROR_INT(
"pixs not defined", __func__, 1);
1728 return ERROR_INT(
"pixs not 8 bpp", __func__, 1);
1729 if (pixim && pixGetDepth(pixim) != 1)
1730 return ERROR_INT(
"pixim not 1 bpp", __func__, 1);
1731 if (sx < 2 || sy < 2)
1732 return ERROR_INT(
"sx and sy must be >= 2", __func__, 1);
1735 wd = (w + sx - 1) / sx;
1736 hd = (h + sy - 1) / sy;
1756 if (pixim && fgpixels) {
1825 l_int32 w, h, wplsm, wpld, i, j;
1827 l_uint32 *datasm, *datad, *linesm, *lined;
1830 if (!pixs || pixGetDepth(pixs) != 8)
1831 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
1832 if (pixGetColormap(pixs))
1833 return (
PIX *)ERROR_PTR(
"pixs has colormap", __func__, NULL);
1836 return (
PIX *)ERROR_PTR(
"w and h must be >= 5", __func__, NULL);
1841 wplsm = pixGetWpl(pixsm);
1846 wpld = pixGetWpl(pixd);
1847 for (i = 0; i < h; i++) {
1848 linesm = datasm + i * wplsm;
1849 lined = datad + i * wpld;
1850 for (j = 0; j < w; j++) {
1853 val16 = (256 * bgval) / val;
1855 L_WARNING(
"smoothed bg has 0 pixel!\n", __func__);
1863 pixCopyResolution(pixd, pixs);
1886 l_int32 w, h, wm, hm, wpls, wpld, i, j, k, m, xoff, yoff;
1889 l_uint32 *datas, *datad, *lines, *lined, *flines, *flined;
1892 if (!pixs || pixGetDepth(pixs) != 8)
1893 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
1894 if (pixGetColormap(pixs))
1895 return (
PIX *)ERROR_PTR(
"pixs has colormap", __func__, NULL);
1896 if (!pixm || pixGetDepth(pixm) != 16)
1897 return (
PIX *)ERROR_PTR(
"pixm undefined or not 16 bpp", __func__, NULL);
1898 if (sx == 0 || sy == 0)
1899 return (
PIX *)ERROR_PTR(
"invalid sx and/or sy", __func__, NULL);
1902 wpls = pixGetWpl(pixs);
1906 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
1908 wpld = pixGetWpl(pixd);
1909 for (i = 0; i < hm; i++) {
1910 lines = datas + sy * i * wpls;
1911 lined = datad + sy * i * wpld;
1913 for (j = 0; j < wm; j++) {
1916 for (k = 0; k < sy && yoff + k < h; k++) {
1917 flines = lines + k * wpls;
1918 flined = lined + k * wpld;
1919 for (m = 0; m < sx && xoff + m < w; m++) {
1921 vald = (vals * val16) / 256;
1922 vald = L_MIN(vald, 255);
1952 l_int32 w, h, wm, hm, wpls, wpld, i, j, k, m, xoff, yoff;
1953 l_int32 rvald, gvald, bvald;
1955 l_uint32 rval16, gval16, bval16;
1956 l_uint32 *datas, *datad, *lines, *lined, *flines, *flined;
1960 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1961 if (pixGetDepth(pixs) != 32)
1962 return (
PIX *)ERROR_PTR(
"pixs not 32 bpp", __func__, NULL);
1963 if (!pixmr || !pixmg || !pixmb)
1964 return (
PIX *)ERROR_PTR(
"pix maps not all defined", __func__, NULL);
1965 if (pixGetDepth(pixmr) != 16 || pixGetDepth(pixmg) != 16 ||
1966 pixGetDepth(pixmb) != 16)
1967 return (
PIX *)ERROR_PTR(
"pix maps not all 16 bpp", __func__, NULL);
1968 if (sx == 0 || sy == 0)
1969 return (
PIX *)ERROR_PTR(
"invalid sx and/or sy", __func__, NULL);
1972 wpls = pixGetWpl(pixs);
1973 w = pixGetWidth(pixs);
1974 h = pixGetHeight(pixs);
1975 wm = pixGetWidth(pixmr);
1976 hm = pixGetHeight(pixmr);
1978 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
1980 wpld = pixGetWpl(pixd);
1981 for (i = 0; i < hm; i++) {
1982 lines = datas + sy * i * wpls;
1983 lined = datad + sy * i * wpld;
1985 for (j = 0; j < wm; j++) {
1990 for (k = 0; k < sy && yoff + k < h; k++) {
1991 flines = lines + k * wpls;
1992 flined = lined + k * wpld;
1993 for (m = 0; m < sx && xoff + m < w; m++) {
1994 vals = *(flines + xoff + m);
1995 rvald = ((vals >> 24) * rval16) / 256;
1996 rvald = L_MIN(rvald, 255);
1997 gvald = (((vals >> 16) & 0xff) * gval16) / 256;
1998 gvald = L_MIN(gvald, 255);
1999 bvald = (((vals >> 8) & 0xff) * bval16) / 256;
2000 bvald = L_MIN(bvald, 255);
2045 l_int32 i, j, w, h, d, wpls, wplg, wpld, vals, valg, vald;
2047 l_uint32 *datas, *datag, *datad, *lines, *lineg, *lined;
2052 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2054 return (
PIX *)ERROR_PTR(
"pixg not defined", __func__, NULL);
2056 return (
PIX *)ERROR_PTR(
"pix sizes not equal", __func__, NULL);
2059 return (
PIX *)ERROR_PTR(
"depth not 8 bpp", __func__, NULL);
2069 if (w * h > 100000) {
2070 lut = (l_uint8 *)LEPT_CALLOC(0x10000,
sizeof(l_uint8));
2071 for (i = 0; i < 256; i++) {
2072 for (j = 0; j < 256; j++) {
2073 fval = (l_float32)(i * target) / (j + 0.5);
2074 lut[(i << 8) + j] = L_MIN(255, (l_int32)(fval + 0.5));
2079 if ((pixd =
pixCreate(w, h, 8)) == NULL) {
2081 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2083 pixCopyResolution(pixd, pixs);
2085 wpld = pixGetWpl(pixd);
2087 wpls = pixGetWpl(pixs);
2089 wplg = pixGetWpl(pixg);
2090 for (i = 0; i < h; i++) {
2091 lines = datas + i * wpls;
2092 lineg = datag + i * wplg;
2093 lined = datad + i * wpld;
2095 for (j = 0; j < w; j++) {
2098 vald = lut[(vals << 8) + valg];
2103 for (j = 0; j < w; j++) {
2106 fval = (l_float32)(vals * target) / (valg + 0.5);
2107 vald = L_MIN(255, (l_int32)(fval + 0.5));
2163 l_int32 w, h, d, i, j, ncolors, rv, gv, bv, wpl;
2164 l_int32 *rarray, *garray, *barray;
2165 l_uint32 *data, *line;
2166 NUMA *nar, *nag, *nab;
2170 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2171 cmap = pixGetColormap(pixs);
2173 if (!cmap && d != 32)
2174 return (
PIX *)ERROR_PTR(
"pixs not cmapped or 32 bpp", __func__, NULL);
2176 L_WARNING(
"mapval must be > 0; setting to 255\n", __func__);
2181 if ((pixd =
pixCopy(pixd, pixs)) == NULL)
2182 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2186 nar =
numaGammaTRC(1.0, 0, L_MAX(1, 255 * rval / mapval));
2187 nag =
numaGammaTRC(1.0, 0, L_MAX(1, 255 * gval / mapval));
2188 nab =
numaGammaTRC(1.0, 0, L_MAX(1, 255 * bval / mapval));
2194 if (!nar || !nag || !nab || !rarray || !garray || !barray) {
2195 L_ERROR(
"allocation failure in arrays\n", __func__);
2196 goto cleanup_arrays;
2201 for (i = 0; i < ncolors; i++) {
2208 wpl = pixGetWpl(pixd);
2209 for (i = 0; i < h; i++) {
2210 line = data + i * wpl;
2211 for (j = 0; j < w; j++) {
2272 l_float32 rankrval, rankgval, rankbval;
2273 l_float32 rfract, gfract, bfract, maxfract;
2276 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
2277 if (pixGetDepth(pixs) != 32)
2278 return (
PIX *)ERROR_PTR(
"pixs not 32 bpp", __func__, NULL);
2280 return (
PIX *)ERROR_PTR(
"sampling factor < 1", __func__, NULL);
2281 if (rank < 0.0 || rank > 1.0)
2282 return (
PIX *)ERROR_PTR(
"rank not in [0.0 ... 1.0]", __func__, NULL);
2283 if (rval <= 0 || gval <= 0 || bval <= 0)
2284 return (
PIX *)ERROR_PTR(
"invalid estim. color values", __func__, NULL);
2297 &rankgval, &rankbval);
2298 rfract = rankrval / (l_float32)rval;
2299 gfract = rankgval / (l_float32)gval;
2300 bfract = rankbval / (l_float32)bval;
2301 maxfract = L_MAX(rfract, gfract);
2302 maxfract = L_MAX(maxfract, bfract);
2304 lept_stderr(
"rankrval = %7.2f, rankgval = %7.2f, rankbval = %7.2f\n",
2305 rankrval, rankgval, rankbval);
2306 lept_stderr(
"rfract = %7.4f, gfract = %7.4f, bfract = %7.4f\n",
2307 rfract, gfract, bfract);
2310 mapval = (l_int32)(255. / maxfract);
2371 l_int32 targetthresh,
2376 PIX *pixe, *pixet, *pixsd, *pixg1, *pixg2, *pixth;
2378 if (ppixth) *ppixth = NULL;
2379 if (ppixb) *ppixb = NULL;
2380 if (ppixd) *ppixd = NULL;
2381 if (!pixs || pixGetDepth(pixs) != 8)
2382 return ERROR_INT(
"pixs not defined or not 8 bpp", __func__, 1);
2383 if (pixGetColormap(pixs))
2384 return ERROR_INT(
"pixs is colormapped", __func__, 1);
2385 if (!ppixth && !ppixb && !ppixd)
2386 return ERROR_INT(
"no output requested", __func__, 1);
2388 return ERROR_INT(
"invalid filter type", __func__, 1);
2409 pixth =
pixGammaTRC(NULL, pixg2, gamma, minval, maxval);
2474 l_float32 scalex, scaley;
2475 PIX *pixt, *pixsd, *pixmin, *pixbg, *pixbgi, *pixd;
2477 if (!pixs || pixGetDepth(pixs) != 8)
2478 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, NULL);
2479 if (pixGetColormap(pixs))
2480 return (
PIX *)ERROR_PTR(
"pixs is colormapped", __func__, NULL);
2481 if (sx < 3 || sy < 3)
2482 return (
PIX *)ERROR_PTR(
"sx and/or sy less than 3", __func__, NULL);
2483 if (sx > 10 || sy > 10)
2484 return (
PIX *)ERROR_PTR(
"sx and/or sy exceed 10", __func__, NULL);
2485 if (smoothx < 1 || smoothy < 1)
2486 return (
PIX *)ERROR_PTR(
"smooth params less than 1", __func__, NULL);
2487 if (smoothx > 3 || smoothy > 3)
2488 return (
PIX *)ERROR_PTR(
"smooth params exceed 3", __func__, NULL);
2491 scalex = 1. / (l_float32)sx;
2492 scaley = 1. / (l_float32)sy;
2568 PIX *pixmin, *pixmax;
2570 if (!pixs || pixGetDepth(pixs) != 8)
2571 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, pixd);
2572 if (pixd && pixd != pixs)
2573 return (
PIX *)ERROR_PTR(
"pixd not null or == pixs", __func__, pixd);
2574 if (pixGetColormap(pixs))
2575 return (
PIX *)ERROR_PTR(
"pixs is colormapped", __func__, pixd);
2576 if (sx < 5 || sy < 5)
2577 return (
PIX *)ERROR_PTR(
"sx and/or sy less than 5", __func__, pixd);
2578 if (smoothx < 0 || smoothy < 0)
2579 return (
PIX *)ERROR_PTR(
"smooth params less than 0", __func__, pixd);
2580 if (smoothx > 8 || smoothy > 8)
2581 return (
PIX *)ERROR_PTR(
"smooth params exceed 8", __func__, pixd);
2585 pixMinMaxTiles(pixs, sx, sy, mindiff, smoothx, smoothy, &pixmin, &pixmax);
2628 PIX *pixmin1, *pixmax1, *pixmin2, *pixmax2;
2630 if (ppixmin) *ppixmin = NULL;
2631 if (ppixmax) *ppixmax = NULL;
2632 if (!ppixmin || !ppixmax)
2633 return ERROR_INT(
"&pixmin or &pixmax undefined", __func__, 1);
2634 if (!pixs || pixGetDepth(pixs) != 8)
2635 return ERROR_INT(
"pixs undefined or not 8 bpp", __func__, 1);
2636 if (pixGetColormap(pixs))
2637 return ERROR_INT(
"pixs is colormapped", __func__, 1);
2638 if (sx < 5 || sy < 5)
2639 return ERROR_INT(
"sx and/or sy less than 3", __func__, 1);
2640 if (smoothx < 0 || smoothy < 0)
2641 return ERROR_INT(
"smooth params less than 0", __func__, 1);
2642 if (smoothx > 5 || smoothy > 5)
2643 return ERROR_INT(
"smooth params exceed 5", __func__, 1);
2667 if (smoothx > 0 || smoothy > 0) {
2668 smoothx = L_MIN(smoothx, (w - 1) / 2);
2669 smoothy = L_MIN(smoothy, (h - 1) / 2);
2677 pixCopyResolution(*ppixmin, pixs);
2678 pixCopyResolution(*ppixmax, pixs);
2711 l_int32 i, j, w, h, d, wpl, val1, val2, found;
2712 l_uint32 *data1, *data2, *line1, *line2;
2714 if (!pixs1 || !pixs2)
2715 return ERROR_INT(
"pixs1 and pixs2 not both defined", __func__, 1);
2717 return ERROR_INT(
"pixs1 and pixs2 not equal size", __func__, 1);
2720 return ERROR_INT(
"depth not 8 bpp", __func__, 1);
2721 if (mindiff > 254)
return 0;
2725 wpl = pixGetWpl(pixs1);
2727 for (i = 0; i < h; i++) {
2728 line1 = data1 + i * wpl;
2729 line2 = data2 + i * wpl;
2730 for (j = 0; j < w; j++) {
2733 if (L_ABS(val1 - val2) >= mindiff) {
2741 L_WARNING(
"no pixel pair diffs as large as mindiff\n", __func__);
2747 for (i = 0; i < h; i++) {
2748 line1 = data1 + i * wpl;
2749 line2 = data2 + i * wpl;
2750 for (j = 0; j < w; j++) {
2753 if (L_ABS(val1 - val2) < mindiff) {
2795 l_int32 i, j, k, m, w, h, wt, ht, wpl, wplt, xoff, yoff;
2796 l_int32 minval, maxval, val, sval;
2799 l_uint32 *data, *datamin, *datamax, *line, *tline, *linemin, *linemax;
2801 if (!pixs || pixGetDepth(pixs) != 8)
2802 return (
PIX *)ERROR_PTR(
"pixs undefined or not 8 bpp", __func__, pixd);
2803 if (pixd && pixd != pixs)
2804 return (
PIX *)ERROR_PTR(
"pixd not null or == pixs", __func__, pixd);
2805 if (pixGetColormap(pixs))
2806 return (
PIX *)ERROR_PTR(
"pixs is colormapped", __func__, pixd);
2807 if (!pixmin || !pixmax)
2808 return (
PIX *)ERROR_PTR(
"pixmin & pixmax not defined", __func__, pixd);
2809 if (sx < 5 || sy < 5)
2810 return (
PIX *)ERROR_PTR(
"sx and/or sy less than 5", __func__, pixd);
2812 iaa = (l_int32 **)LEPT_CALLOC(256,
sizeof(l_int32 *));
2813 if ((pixd =
pixCopy(pixd, pixs)) == NULL) {
2815 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
2820 wpl = pixGetWpl(pixd);
2823 wplt = pixGetWpl(pixmin);
2825 for (i = 0; i < ht; i++) {
2826 line = data + sy * i * wpl;
2827 linemin = datamin + i * wplt;
2828 linemax = datamax + i * wplt;
2830 for (j = 0; j < wt; j++) {
2834 if (maxval == minval) {
2835 L_ERROR(
"shouldn't happen! i,j = %d,%d, minval = %d\n",
2836 __func__, i, j, minval);
2840 L_ERROR(
"failure to make ia for j = %d!\n", __func__, j);
2843 for (k = 0; k < sy && yoff + k < h; k++) {
2844 tline = line + k * wpl;
2845 for (m = 0; m < sx && xoff + m < w; m++) {
2847 sval = val - minval;
2848 sval = L_MAX(0, sval);
2855 for (i = 0; i < 256; i++)
2880 return (l_int32 *)ERROR_PTR(
"iaa not defined", __func__, NULL);
2882 if (iaa[diff] != NULL)
2885 ia = (l_int32 *)LEPT_CALLOC(256,
sizeof(l_int32));
2888 for (i = 0; i < 256; i++)
2892 factor = 255. / (l_float32)diff;
2893 for (i = 0; i < diff + 1; i++)
2894 ia[i] = (l_int32)(factor * i + 0.5);
2895 for (i = diff + 1; i < 256; i++)
l_ok 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()
l_ok pixBackgroundNormRGBArraysMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval, PIX **ppixr, PIX **ppixg, PIX **ppixb)
pixBackgroundNormRGBArraysMorph()
static const l_int32 DefaultFgThreshold
static const l_int32 DefaultTileHeight
PIX * pixBackgroundNormSimple(PIX *pixs, PIX *pixim, PIX *pixg)
pixBackgroundNormSimple()
static l_int32 * iaaGetLinearTRC(l_int32 **iaa, l_int32 diff)
iaaGetLinearTRC()
l_ok 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()
l_ok pixSmoothConnectedRegions(PIX *pixs, PIX *pixm, l_int32 factor)
pixSmoothConnectedRegions()
PIX * pixGlobalNormRGB(PIX *pixd, PIX *pixs, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 mapval)
pixGlobalNormRGB()
PIX * pixCleanBackgroundToWhite(PIX *pixs, PIX *pixim, PIX *pixg, l_float32 gamma, l_int32 blackval, l_int32 whiteval)
pixCleanBackgroundToWhite()
PIX * pixContrastNorm(PIX *pixd, PIX *pixs, l_int32 sx, l_int32 sy, l_int32 mindiff, l_int32 smoothx, l_int32 smoothy)
pixContrastNorm()
l_ok pixBackgroundNormGrayArrayMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval, PIX **ppixd)
pixBackgroundNormGrayArrayMorph()
l_ok pixGetBackgroundGrayMap(PIX *pixs, PIX *pixim, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, PIX **ppixd)
pixGetBackgroundGrayMap()
PIX * pixGetInvBackgroundMap(PIX *pixs, l_int32 bgval, l_int32 smoothx, l_int32 smoothy)
pixGetInvBackgroundMap()
PIX * pixApplyInvBackgroundGrayMap(PIX *pixs, PIX *pixm, l_int32 sx, l_int32 sy)
pixApplyInvBackgroundGrayMap()
l_ok pixGetBackgroundRGBMapMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, PIX **ppixmr, PIX **ppixmg, PIX **ppixmb)
pixGetBackgroundRGBMapMorph()
static l_int32 pixSetLowContrast(PIX *pixs1, PIX *pixs2, l_int32 mindiff)
pixSetLowContrast()
static const l_int32 DefaultBgVal
PIX * pixGlobalNormNoSatRGB(PIX *pixd, PIX *pixs, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 factor, l_float32 rank)
pixGlobalNormNoSatRGB()
l_ok 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()
static const l_int32 DefaultTileWidth
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()
static const l_int32 DefaultMinCount
PIX * pixApplyVariableGrayMap(PIX *pixs, PIX *pixg, l_int32 target)
pixApplyVariableGrayMap()
PIX * pixBackgroundNormFlex(PIX *pixs, l_int32 sx, l_int32 sy, l_int32 smoothx, l_int32 smoothy, l_int32 delta)
pixBackgroundNormFlex()
PIX * pixApplyInvBackgroundRGBMap(PIX *pixs, PIX *pixmr, PIX *pixmg, PIX *pixmb, l_int32 sx, l_int32 sy)
pixApplyInvBackgroundRGBMap()
l_ok pixFillMapHoles(PIX *pix, l_int32 nx, l_int32 ny, l_int32 filltype)
pixFillMapHoles()
l_ok pixGetBackgroundGrayMapMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, PIX **ppixm)
pixGetBackgroundGrayMapMorph()
PIX * pixExtendByReplication(PIX *pixs, l_int32 addw, l_int32 addh)
pixExtendByReplication()
static 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()
static const l_int32 DefaultXSmoothSize
static PIX * pixLinearTRCTiled(PIX *pixd, PIX *pixs, l_int32 sx, l_int32 sy, PIX *pixmin, PIX *pixmax)
pixLinearTRCTiled()
static const l_int32 DefaultYSmoothSize
l_ok 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 * pixBackgroundNormMorph(PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval)
pixBackgroundNormMorph()
#define SET_DATA_TWO_BYTES(pdata, n, val)
#define GET_DATA_BYTE(pdata, n)
#define SET_DATA_BYTE(pdata, n, val)
#define GET_DATA_BIT(pdata, n)
PIX * pixReduceBinary2(PIX *pixs, l_uint8 *intab)
pixReduceBinary2()
l_ok boxaGetBoxGeometry(BOXA *boxa, l_int32 index, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxaGetBoxGeometry()
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
l_int32 boxaGetCount(const BOXA *boxa)
boxaGetCount()
l_int32 pixcmapGetCount(const PIXCMAP *cmap)
pixcmapGetCount()
l_ok pixcmapResetColor(PIXCMAP *cmap, l_int32 index, l_int32 rval, l_int32 gval, l_int32 bval)
pixcmapResetColor()
l_ok pixcmapGetColor(PIXCMAP *cmap, l_int32 index, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
pixcmapGetColor()
BOXA * pixConnComp(PIX *pixs, PIXA **ppixa, l_int32 connectivity)
pixConnComp()
PIX * pixBlockconv(PIX *pix, l_int32 wc, l_int32 hc)
pixBlockconv()
PIX * pixTwoSidedEdgeFilter(PIX *pixs, l_int32 orientflag)
pixTwoSidedEdgeFilter()
PIX * pixSobelEdgeFilter(PIX *pixs, l_int32 orientflag)
pixSobelEdgeFilter()
NUMA * numaGammaTRC(l_float32 gamma, l_int32 minval, l_int32 maxval)
numaGammaTRC()
PIX * pixGammaTRC(PIX *pixd, PIX *pixs, l_float32 gamma, l_int32 minval, l_int32 maxval)
pixGammaTRC()
PIX * pixCloseGray(PIX *pixs, l_int32 hsize, l_int32 vsize)
pixCloseGray()
PIX * pixVarThresholdToBinary(PIX *pixs, PIX *pixg)
pixVarThresholdToBinary()
PIX * pixThresholdToBinary(PIX *pixs, l_int32 thresh)
pixThresholdToBinary()
PIX * pixMorphSequence(PIX *pixs, const char *sequence, l_int32 dispsep)
pixMorphSequence()
l_ok numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
NUMA * numaCreate(l_int32 n)
numaCreate()
void numaDestroy(NUMA **pna)
numaDestroy()
l_ok numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_int32 * numaGetIArray(NUMA *na)
numaGetIArray()
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()
l_int32 pixSizesEqual(const PIX *pix1, const PIX *pix2)
pixSizesEqual()
PIX * pixCopy(PIX *pixd, const PIX *pixs)
pixCopy()
PIX * pixCreateTemplate(const PIX *pixs)
pixCreateTemplate()
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
PIX * pixClone(PIX *pixs)
pixClone()
l_ok pixSetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 val)
pixSetPixel()
l_ok pixClearAll(PIX *pix)
pixClearAll()
l_ok pixGetPixel(PIX *pix, l_int32 x, l_int32 y, l_uint32 *pval)
pixGetPixel()
l_ok composeRGBPixel(l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *ppixel)
composeRGBPixel()
void extractRGBValues(l_uint32 pixel, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
extractRGBValues()
l_ok pixZero(PIX *pix, l_int32 *pempty)
pixZero()
PIX * pixInvert(PIX *pixd, PIX *pixs)
pixInvert()
l_ok pixPaintThroughMask(PIX *pixd, PIX *pixm, l_int32 x, l_int32 y, l_uint32 val)
pixPaintThroughMask()
PIX * pixAnd(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixAnd()
l_ok pixCombineMasked(PIX *pixd, PIX *pixs, PIX *pixm)
pixCombineMasked()
l_ok pixGetAverageMasked(PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor, l_int32 type, l_float32 *pval)
pixGetAverageMasked()
l_ok 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()
void pixaDestroy(PIXA **ppixa)
pixaDestroy()
PIX * pixaGetPix(PIXA *pixa, l_int32 index, l_int32 accesstype)
pixaGetPix()
l_ok pixAddConstantGray(PIX *pixs, l_int32 val)
pixAddConstantGray()
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
PIX * pixConvertRGBToGrayFast(PIX *pixs)
pixConvertRGBToGrayFast()
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()
PIX * pixScaleRGBToGrayFast(PIX *pixs, l_int32 factor, l_int32 color)
pixScaleRGBToGrayFast()
PIX * pixScale(PIX *pixs, l_float32 scalex, l_float32 scaley)
pixScale()
PIX * pixScaleSmooth(PIX *pix, l_float32 scalex, l_float32 scaley)
pixScaleSmooth()
PIX * pixScaleBySampling(PIX *pixs, l_float32 scalex, l_float32 scaley)
pixScaleBySampling()
PIX * pixExpandReplicate(PIX *pixs, l_int32 factor)
pixExpandReplicate()
PIX * pixScaleGrayMinMax(PIX *pixs, l_int32 xfact, l_int32 yfact, l_int32 type)
pixScaleGrayMinMax()
PIX * pixSeedspread(PIX *pixs, l_int32 connectivity)
pixSeedspread()
PIX * pixSeedfillGrayBasin(PIX *pixb, PIX *pixm, l_int32 delta, l_int32 connectivity)
pixSeedfillGrayBasin()
l_ok pixLocalExtrema(PIX *pixs, l_int32 maxmin, l_int32 minmax, PIX **ppixmin, PIX **ppixmax)
pixLocalExtrema()
void lept_stderr(const char *fmt,...)
lept_stderr()