152 #include <config_auto.h>
155 #include "allheaders.h"
211 l_int32 w, h, i, j, wpl1, wplr, wplg, wplb;
212 l_int32 rval, gval, bval, rgdiff, rbdiff, gbdiff, maxval, colorval;
214 l_uint32 *data1, *datar, *datag, *datab, *line1, *liner, *lineg, *lineb;
215 PIX *pix1, *pixr, *pixg, *pixb;
217 if (!ppixr && !ppixg && !ppixb)
218 return ERROR_INT(
"no return val requested", __func__, 1);
219 if (ppixr) *ppixr = NULL;
220 if (ppixg) *ppixg = NULL;
221 if (ppixb) *ppixb = NULL;
223 return ERROR_INT(
"pixs not defined", __func__, 1);
224 if (mingray < 0) mingray = 0;
226 return ERROR_INT(
"mingray > 255", __func__, 1);
230 return ERROR_INT(
"pix1 not returned", __func__, 1);
232 pixr = pixg = pixb = NULL;
237 wplr = pixGetWpl(pixr);
243 wplg = pixGetWpl(pixg);
249 wplb = pixGetWpl(pixb);
254 wpl1 = pixGetWpl(pix1);
255 for (i = 0; i < h; i++) {
256 line1 = data1 + i * wpl1;
258 liner = datar + i * wplr;
260 lineg = datag + i * wplg;
262 lineb = datab + i * wplb;
263 for (j = 0; j < w; j++) {
267 maxval = L_MAX(rval, gval);
268 maxval = L_MAX(maxval, bval);
269 if (maxval < mingray)
272 rgdiff = L_ABS(rval - gval);
273 rbdiff = L_ABS(rval - bval);
274 gbdiff = L_ABS(gval - bval);
276 colorval = (rgdiff + rbdiff) / 2;
280 colorval = (rgdiff + gbdiff) / 2;
284 colorval = (rbdiff + gbdiff) / 2;
366 l_int32 w, h, i, j, wpl1, wpld;
367 l_int32 rval, gval, bval, rdist, gdist, bdist, colorval;
368 l_int32 rgdist, rbdist, gbdist, mindist, maxdist, minval, maxval;
370 l_uint32 *data1, *datad, *line1, *lined;
374 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
377 return (
PIX *)ERROR_PTR(
"invalid type", __func__, NULL);
381 return (
PIX *)ERROR_PTR(
"pix1 not returned", __func__, NULL);
386 wpld = pixGetWpl(pixd);
388 wpl1 = pixGetWpl(pix1);
389 for (i = 0; i < h; i++) {
390 line1 = data1 + i * wpl1;
391 lined = datad + i * wpld;
392 for (j = 0; j < w; j++) {
396 rgdist = L_ABS(rval - gval);
397 rbdist = L_ABS(rval - bval);
398 gbdist = L_ABS(gval - bval);
399 maxdist = L_MAX(rgdist, rbdist);
400 if (gbdist >= maxdist) {
403 mindist = L_MIN(rgdist, rbdist);
404 colorval = L_MAX(mindist, gbdist);
407 rdist = ((gval + bval ) / 2 - rval);
408 rdist = L_ABS(rdist);
409 gdist = ((rval + bval ) / 2 - gval);
410 gdist = L_ABS(gdist);
411 bdist = ((rval + gval ) / 2 - bval);
412 bdist = L_ABS(bdist);
413 colorval = L_MAX(rdist, gdist);
414 colorval = L_MAX(colorval, bdist);
416 minval = L_MIN(rval, gval);
417 minval = L_MIN(minval, bval);
418 maxval = L_MAX(rval, gval);
419 maxval = L_MAX(maxval, bval);
420 colorval = maxval - minval;
495 l_float32 *ppixfract,
496 l_float32 *pcolorfract)
498 l_int32 i, j, w, h, wpl, rval, gval, bval, minval, maxval;
499 l_int32 total, npix, ncolor;
501 l_uint32 *data, *line;
503 if (ppixfract) *ppixfract = 0.0;
504 if (pcolorfract) *pcolorfract = 0.0;
505 if (!ppixfract || !pcolorfract)
506 return ERROR_INT(
"&pixfract and &colorfract not defined",
508 if (!pixs || pixGetDepth(pixs) != 32)
509 return ERROR_INT(
"pixs not defined or not 32 bpp", __func__, 1);
513 wpl = pixGetWpl(pixs);
514 npix = ncolor = total = 0;
515 for (i = 0; i < h; i += factor) {
516 line = data + i * wpl;
517 for (j = 0; j < w; j += factor) {
521 minval = L_MIN(rval, gval);
522 minval = L_MIN(minval, bval);
523 if (minval > lightthresh)
525 maxval = L_MAX(rval, gval);
526 maxval = L_MAX(maxval, bval);
527 if (maxval < darkthresh)
531 if (maxval - minval >= diffthresh)
537 L_WARNING(
"No pixels found for consideration\n", __func__);
540 *ppixfract = (l_float32)npix / (l_float32)total;
541 *pcolorfract = (l_float32)ncolor / (l_float32)npix;
582 l_int32 w, h, i, j, wpl1, wpl2, rval, gval, bval;
583 l_int32 *rtab, *gtab, *btab;
585 l_uint32 *data1, *data2, *line1, *line2;
586 NUMA *nar, *nag, *nab;
591 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
593 cmap = pixGetColormap(pixs);
594 if (!cmap && pixGetDepth(pixs) != 32)
595 return (
PIX *)ERROR_PTR(
"pixs neither cmapped nor 32 bpp",
602 if (!rref && !gref && !bref)
606 if ((rref < 0 || gref < 0 || bref < 0) || (rref * gref * bref == 0)) {
607 L_WARNING(
"invalid set of ref values\n", __func__);
615 wpl1 = pixGetWpl(pix1);
617 wpl2 = pixGetWpl(pix2);
624 for (i = 0; i < h; i++) {
625 line1 = data1 + i * wpl1;
626 line2 = data2 + i * wpl2;
627 for (j = 0; j < w; j++) {
684 l_int32 w, h, d, i, j, wpls, wpld, size;
685 l_int32 rval, gval, bval, minval, maxval;
686 l_uint32 *datas, *datad, *lines, *lined;
691 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
694 cmap = pixGetColormap(pixs);
695 if (!cmap && d != 32)
696 return (
PIX *)ERROR_PTR(
"pixs not cmapped or 32 bpp", __func__, NULL);
701 if (!pixc || pixGetDepth(pixc) != 32) {
703 return (
PIX *)ERROR_PTR(
"rgb pix not made", __func__, NULL);
708 wpld = pixGetWpl(pixd);
710 wpls = pixGetWpl(pixc);
711 for (i = 0; i < h; i++) {
712 lines = datas + i * wpls;
713 lined = datad + i * wpld;
714 for (j = 0; j < w; j++) {
716 minval = L_MIN(rval, gval);
717 minval = L_MIN(minval, bval);
718 maxval = L_MAX(rval, gval);
719 maxval = L_MAX(maxval, bval);
720 if (maxval - minval >= threshdiff)
726 size = 2 * (mindist - 1) + 1;
764 l_int32 w, h, i, j, wpls, wpld;
765 l_int32 rval, gval, bval, minrg, min, maxrg, max, sat;
766 l_uint32 *datas, *datad, *lines, *lined;
769 if (!pixs || pixGetDepth(pixs) != 32)
770 return (
PIX *)ERROR_PTR(
"pixs undefined or not 32 bpp", __func__, NULL);
771 if (maxlimit < 0 || maxlimit > 255)
772 return (
PIX *)ERROR_PTR(
"invalid maxlimit", __func__, NULL);
774 return (
PIX *)ERROR_PTR(
"invalid satlimit", __func__, NULL);
778 wpls = pixGetWpl(pixs);
780 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
782 wpld = pixGetWpl(pixd);
784 for (i = 0; i < h; i++) {
785 lines = datas + i * wpls;
786 lined = datad + i * wpld;
787 for (j = 0; j < w; j++) {
789 minrg = L_MIN(rval, gval);
790 min = L_MIN(minrg, bval);
791 maxrg = L_MAX(rval, gval);
792 max = L_MAX(maxrg, bval);
794 if (max <= maxlimit && sat <= satlimit)
824 l_int32 w, h, d, i, j, wpls, wpld;
825 l_int32 rval, gval, bval;
826 l_uint32 *datas, *datad, *lines, *lined;
831 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
834 cmap = pixGetColormap(pixs);
835 if (!cmap && d != 32)
836 return (
PIX *)ERROR_PTR(
"pixs not cmapped or 32 bpp", __func__, NULL);
844 wpld = pixGetWpl(pixd);
846 wpls = pixGetWpl(pixc);
847 for (i = 0; i < h; i++) {
848 lines = datas + i * wpls;
849 lined = datad + i * wpld;
850 for (j = 0; j < w; j++) {
852 if (rval < rmin || rval > rmax)
continue;
853 if (gval < gmin || gval > gmax)
continue;
854 if (bval < bmin || bval > bmax)
continue;
941 l_float32 *pcolorfract,
946 l_int32 w, h, count, rval, gval, bval, aveval, proceed;
950 PIX *pix1, *pix2, *pix3, *pix4, *pix5, *pixm1, *pixm2, *pixm3;
952 if (pcolormask1) *pcolormask1 = NULL;
953 if (pcolormask2) *pcolormask2 = NULL;
955 return ERROR_INT(
"&colorfract not defined", __func__, 1);
957 if (!pixs || pixGetDepth(pixs) != 32)
958 return ERROR_INT(
"pixs not defined or not 32 bpp", __func__, 1);
959 if (factor < 1) factor = 1;
960 if (lightthresh < 0) lightthresh = 210;
961 if (darkthresh < 0) darkthresh = 70;
962 if (mindiff < 0) mindiff = 10;
963 if (colordiff < 0) colordiff = 90;
964 if (edgefract < 0.0 || edgefract > 1.0) edgefract = 0.05;
970 if (pixadb) L_INFO(
"pixm has big fg: %f5.2\n", __func__, ratio);
980 return ERROR_INT(
"rank color array not made", __func__, 1);
982 if (pixadb) L_INFO(
"lightest background color: (r,g,b) = (%d,%d,%d)\n",
983 __func__, rval, gval, bval);
985 if ((rval < bval - 2) || (rval < gval - 2)) {
986 if (pixadb) L_INFO(
"background not reddish\n", __func__);
989 aveval = (rval + gval + bval) / 3;
990 if (aveval < lightthresh) {
991 if (pixadb) L_INFO(
"background too dark\n", __func__);
999 if (proceed == FALSE)
return 0;
1011 pixOr(pixm1, pixm1, pixm);
1024 pixOr(pixm2, pixm2, pix1);
1030 pixOr(pixm2, pixm2, pix2);
1050 if (edgefract > 0.0) {
1052 pixAnd(pixm3, pixm3, pix2);
1059 *pcolorfract = (l_float32)count / ((l_float32)(w) * h);
1062 L_INFO(
"no light color pixels found\n", __func__);
1064 L_INFO(
"fraction of light color pixels = %5.3f\n", __func__,
1069 if (pixadb && count > 0) {
1101 if (pcolormask2 && count > 0)
1103 if (pcolormask1 && count > 0)
1104 *pcolormask1 = pixm3;
1149 l_int32 lightthresh,
1154 l_int32 i, w, h, count, mincount, ncolors;
1158 return ERROR_INT(
"&ncolors not defined", __func__, 1);
1160 if (!pixs || pixGetDepth(pixs) != 8)
1161 return ERROR_INT(
"pixs not defined or not 8 bpp", __func__, 1);
1162 if (darkthresh < 0) darkthresh = 20;
1163 if (lightthresh < 0) lightthresh = 236;
1164 if (minfract < 0.0) minfract = 0.0001;
1166 return ERROR_INT(
"minfract > 1.0", __func__, 1);
1167 if (minfract >= 0.001)
1168 L_WARNING(
"minfract too big; likely to underestimate ncolors\n",
1170 if (lightthresh > 255 || darkthresh >= lightthresh)
1171 return ERROR_INT(
"invalid thresholds", __func__, 1);
1172 if (factor < 1) factor = 1;
1175 mincount = (l_int32)(minfract * w * h * factor * factor);
1177 return ERROR_INT(
"na not made", __func__, 1);
1179 for (i = darkthresh; i <= lightthresh; i++) {
1181 if (count >= mincount)
1185 *pncolors = ncolors;
1274 l_int32 w, h, d, minside, factor;
1275 l_float32 pixfract, colorfract;
1276 PIX *pixt, *pixsc, *pixg, *pixe, *pixb, *pixm;
1279 if (piscolor) *piscolor = 0;
1281 return ERROR_INT(
"&ncolors not defined", __func__, 1);
1284 return ERROR_INT(
"pixs not defined", __func__, 1);
1285 if ((cmap = pixGetColormap(pixs)) != NULL) {
1293 if (d != 8 && d != 32)
1294 return ERROR_INT(
"pixs not 8 or 32 bpp", __func__, 1);
1303 minside = L_MIN(w, h);
1307 factor = L_MAX(1, minside / 400);
1309 if (pixfract * colorfract < 0.00025) {
1324 factor = L_MAX(1, minside / 500);
1327 else if (factor == 2 || factor == 3)
1364 if (debug) pixWrite(
"junkpix8.png", pixg, IFF_PNG);
1368 if (debug) pixWrite(
"junkpix32.png", pixsc, IFF_PNG);
1412 l_int32 w, h, d, i, j, wpl, hashsize, sum, count, manycolors;
1413 l_int32 rval, gval, bval, val;
1416 l_uint32 *data, *line;
1420 return ERROR_INT(
"&ncolors not defined", __func__, 1);
1423 return ERROR_INT(
"pixs not defined", __func__, 1);
1425 if (d != 2 && d != 4 && d != 8 && d != 32)
1426 return ERROR_INT(
"d not in {2, 4, 8, 32}", __func__, 1);
1427 if (factor < 1) factor = 1;
1430 wpl = pixGetWpl(pixs);
1433 inta = (l_int32 *)LEPT_CALLOC(256,
sizeof(l_int32));
1434 for (i = 0; i < h; i += factor) {
1435 line = data + i * wpl;
1436 for (j = 0; j < w; j += factor) {
1446 for (i = 0; i < 256; i++)
1451 cmap = pixGetColormap(pixs);
1452 if (cmap && factor == 1) {
1455 L_WARNING(
"colormap size %d differs from actual colors\n",
1463 inta = (l_int32 *)LEPT_CALLOC(hashsize,
sizeof(l_int32));
1465 for (i = 0; i < h && manycolors == 0; i += factor) {
1466 line = data + i * wpl;
1467 for (j = 0; j < w; j += factor) {
1470 val = (137 * rval + 269 * gval + 353 * bval) % hashsize;
1471 if (inta[val] == 0) {
1483 if (manycolors == 0) {
1511 l_int32 w, h, d, i, j, wpls, wpld, hashsize, hashval, ncolors, index;
1512 l_int32 rval, gval, bval, val;
1513 l_int32 *hasha1, *hasha2;
1515 l_uint32 *datas, *lines, *datad, *lined;
1519 if (!pixs || pixGetDepth(pixs) != 32)
1520 return (
PIX *)ERROR_PTR(
"pixs undefined or not 32 bpp", __func__, NULL);
1523 if (ncolors > 256) {
1524 L_ERROR(
"too many colors found: %d\n", __func__, ncolors);
1531 else if (ncolors <= 4)
1533 else if (ncolors <= 16)
1538 if ((pixd =
pixCreate(w, h, d)) == NULL)
1539 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
1542 wpls = pixGetWpl(pixs);
1544 wpld = pixGetWpl(pixd);
1551 hasha1 = (l_int32 *)LEPT_CALLOC(hashsize,
sizeof(l_int32));
1552 hasha2 = (l_int32 *)LEPT_CALLOC(hashsize,
sizeof(l_int32));
1554 for (i = 0; i < h; i++) {
1555 lines = datas + i * wpls;
1556 lined = datad + i * wpld;
1557 for (j = 0; j < w; j++) {
1560 hashval = (137 * rval + 269 * gval + 353 * bval) % hashsize;
1561 if (hasha1[hashval] == 0) {
1562 hasha1[hashval] = 1;
1564 hasha2[hashval] = index;
1567 val = hasha2[hashval];
1611 l_int32 n, i, rgbindex, rval, gval, bval;
1612 NUMA *nahisto, *naindex;
1614 if (!parray && !pcmap)
1615 return ERROR_INT(
"no return val requested", __func__, 1);
1616 if (parray) *parray = NULL;
1617 if (pcmap) *pcmap = NULL;
1618 if (!pixs || pixGetDepth(pixs) != 32)
1619 return ERROR_INT(
"pixs not defined", __func__, 1);
1620 if (sigbits < 2 || sigbits > 6)
1621 return ERROR_INT(
"sigbits not in [2 ... 6]", __func__, 1);
1622 if (factor < 1 || ncolors < 1)
1623 return ERROR_INT(
"factor < 1 or ncolors < 1", __func__, 1);
1626 return ERROR_INT(
"nahisto not made", __func__, 1);
1632 return ERROR_INT(
"naindex not made", __func__, 1);
1635 ncolors = L_MIN(n, ncolors);
1636 if (parray) *parray = (l_uint32 *)LEPT_CALLOC(ncolors,
sizeof(l_uint32));
1638 for (i = 0; i < ncolors; i++) {
1688 if (!pixs || pixGetDepth(pixs) != 32)
1689 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1690 if (sigbits < 2 || sigbits > 4)
1691 return (
PIX *)ERROR_PTR(
"sigbits not in {2,3,4}", __func__, NULL);
1727 l_int32 w, h, i, j, size, wpl, rval, gval, bval, npts;
1728 l_uint32 val32, rgbindex;
1730 l_uint32 *data, *line, *rtab, *gtab, *btab;
1733 if (!pixs || pixGetDepth(pixs) != 32)
1734 return (
NUMA *)ERROR_PTR(
"pixs not defined", __func__, NULL);
1735 if (sigbits < 2 || sigbits > 6)
1736 return (
NUMA *)ERROR_PTR(
"sigbits not in [2 ... 6]", __func__, NULL);
1738 return (
NUMA *)ERROR_PTR(
"factor < 1", __func__, NULL);
1741 size = 1 << (3 * sigbits);
1749 npts = ((w + factor - 1) / factor) * ((h + factor - 1) / factor);
1751 L_WARNING(
"only sampling %d pixels\n", __func__, npts);
1752 wpl = pixGetWpl(pixs);
1754 for (i = 0; i < h; i += factor) {
1755 line = data + i * wpl;
1756 for (j = 0; j < w; j += factor) {
1757 val32 = *(line + j);
1759 rgbindex = rtab[rval] | gtab[gval] | btab[bval];
1795 l_uint32 *rtab, *gtab, *btab;
1797 if (prtab) *prtab = NULL;
1798 if (pgtab) *pgtab = NULL;
1799 if (pbtab) *pbtab = NULL;
1800 if (!prtab || !pgtab || !pbtab)
1801 return ERROR_INT(
"not all table ptrs defined", __func__, 1);
1802 if (sigbits < 2 || sigbits > 6)
1803 return ERROR_INT(
"sigbits not in [2 ... 6]", __func__, 1);
1805 rtab = (l_uint32 *)LEPT_CALLOC(256,
sizeof(l_uint32));
1806 gtab = (l_uint32 *)LEPT_CALLOC(256,
sizeof(l_uint32));
1807 btab = (l_uint32 *)LEPT_CALLOC(256,
sizeof(l_uint32));
1808 if (!rtab || !gtab || !btab) {
1812 return ERROR_INT(
"calloc fail for tab", __func__, 1);
1819 for (i = 0; i < 256; i++) {
1820 rtab[i] = (i & 0xc0) >> 2;
1821 gtab[i] = (i & 0xc0) >> 4;
1822 btab[i] = (i & 0xc0) >> 6;
1826 for (i = 0; i < 256; i++) {
1827 rtab[i] = (i & 0xe0) << 1;
1828 gtab[i] = (i & 0xe0) >> 2;
1829 btab[i] = (i & 0xe0) >> 5;
1833 for (i = 0; i < 256; i++) {
1834 rtab[i] = (i & 0xf0) << 4;
1835 gtab[i] = (i & 0xf0);
1836 btab[i] = (i & 0xf0) >> 4;
1840 for (i = 0; i < 256; i++) {
1841 rtab[i] = (i & 0xf8) << 7;
1842 gtab[i] = (i & 0xf8) << 2;
1843 btab[i] = (i & 0xf8) >> 3;
1847 for (i = 0; i < 256; i++) {
1848 rtab[i] = (i & 0xfc) << 10;
1849 gtab[i] = (i & 0xfc) << 4;
1850 btab[i] = (i & 0xfc) >> 2;
1854 L_ERROR(
"Illegal sigbits = %d\n", __func__, sigbits);
1855 return ERROR_INT(
"sigbits not in [2 ... 6]", __func__, 1);
1887 if (prval) *prval = 0;
1888 if (pgval) *pgval = 0;
1889 if (pbval) *pbval = 0;
1890 if (!prval || !pgval || !pbval)
1891 return ERROR_INT(
"not all component ptrs defined", __func__, 1);
1892 if (sigbits < 2 || sigbits > 6)
1893 return ERROR_INT(
"sigbits not in [2 ... 6]", __func__, 1);
1897 *prval = ((index << 2) & 0xc0) | 0x20;
1898 *pgval = ((index << 4) & 0xc0) | 0x20;
1899 *pbval = ((index << 6) & 0xc0) | 0x20;
1902 *prval = ((index >> 1) & 0xe0) | 0x10;
1903 *pgval = ((index << 2) & 0xe0) | 0x10;
1904 *pbval = ((index << 5) & 0xe0) | 0x10;
1907 *prval = ((index >> 4) & 0xf0) | 0x08;
1908 *pgval = (index & 0xf0) | 0x08;
1909 *pbval = ((index << 4) & 0xf0) | 0x08;
1912 *prval = ((index >> 7) & 0xf8) | 0x04;
1913 *pgval = ((index >> 2) & 0xf8) | 0x04;
1914 *pbval = ((index << 3) & 0xf8) | 0x04;
1917 *prval = ((index >> 10) & 0xfc) | 0x02;
1918 *pgval = ((index >> 4) & 0xfc) | 0x02;
1919 *pbval = ((index << 2) & 0xfc) | 0x02;
1922 L_ERROR(
"Illegal sigbits = %d\n", __func__, sigbits);
1923 return ERROR_INT(
"sigbits not in [2 ... 6]", __func__, 1);
1970 l_float32 fract, ratio;
1971 PIX *pix1, *pix2, *pix3, *pix4;
1974 if (pratio) *pratio = 0.0;
1975 if (ppixdb) *ppixdb = NULL;
1976 if (phasred) *phasred = 0;
1977 if (!pratio && !ppixdb)
1978 return ERROR_INT(
"no return val requested", __func__, 1);
1980 return ERROR_INT(
"&hasred not defined", __func__, 1);
1981 if (!pixs || pixGetDepth(pixs) != 32)
1982 return ERROR_INT(
"pixs not defined or not 32 bpp", __func__, 1);
1983 if (minfract <= 0.0)
1984 return ERROR_INT(
"minfract must be > 0.0", __func__, 1);
1985 if (fthresh < 1.5 || fthresh > 3.5)
1986 L_WARNING(
"fthresh = %f is out of normal bounds\n", __func__, fthresh);
2003 pixAnd(pix4, pix4, pix2);
2005 ratio = fract / minfract;
2006 L_INFO(
"fract = %7.5f, ratio = %7.3f\n", __func__, fract, ratio);
2007 if (pratio) *pratio = ratio;
#define GET_DATA_QBIT(pdata, n)
#define SET_DATA_BIT(pdata, n)
#define GET_DATA_BYTE(pdata, n)
#define GET_DATA_DIBIT(pdata, n)
#define SET_DATA_BYTE(pdata, n, val)
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
BOXA * boxaCombineOverlaps(BOXA *boxas, PIXA *pixadb)
boxaCombineOverlaps()
PIX * pixMaskBoxa(PIX *pixd, PIX *pixs, BOXA *boxa, l_int32 op)
pixMaskBoxa()
PIX * pixConvertRGBToCmapLossless(PIX *pixs)
pixConvertRGBToCmapLossless()
l_ok pixNumSignificantGrayColors(PIX *pixs, l_int32 darkthresh, l_int32 lightthresh, l_float32 minfract, l_int32 factor, l_int32 *pncolors)
pixNumSignificantGrayColors()
NUMA * pixGetRGBHistogram(PIX *pixs, l_int32 sigbits, l_int32 factor)
pixGetRGBHistogram()
PIX * pixSimpleColorQuantize(PIX *pixs, l_int32 sigbits, l_int32 factor, l_int32 ncolors)
pixSimpleColorQuantize()
PIX * pixColorMagnitude(PIX *pixs, l_int32 rref, l_int32 gref, l_int32 bref, l_int32 type)
pixColorMagnitude()
PIX * pixColorShiftWhitePoint(PIX *pixs, l_int32 rref, l_int32 gref, l_int32 bref)
pixColorShiftWhitePoint()
l_ok pixColorsForQuantization(PIX *pixs, l_int32 thresh, l_int32 *pncolors, l_int32 *piscolor, l_int32 debug)
pixColorsForQuantization()
l_ok pixColorFraction(PIX *pixs, l_int32 darkthresh, l_int32 lightthresh, l_int32 diffthresh, l_int32 factor, l_float32 *ppixfract, l_float32 *pcolorfract)
pixColorFraction()
l_ok pixHasHighlightRed(PIX *pixs, l_int32 factor, l_float32 minfract, l_float32 fthresh, l_int32 *phasred, l_float32 *pratio, PIX **ppixdb)
pixHasHighlightRed()
l_ok pixColorContent(PIX *pixs, l_int32 rref, l_int32 gref, l_int32 bref, l_int32 mingray, PIX **ppixr, PIX **ppixg, PIX **ppixb)
pixColorContent()
PIX * pixMaskOverColorPixels(PIX *pixs, l_int32 threshdiff, l_int32 mindist)
pixMaskOverColorPixels()
l_ok pixGetMostPopulatedColors(PIX *pixs, l_int32 sigbits, l_int32 factor, l_int32 ncolors, l_uint32 **parray, PIXCMAP **pcmap)
pixGetMostPopulatedColors()
PIX * pixMaskOverColorRange(PIX *pixs, l_int32 rmin, l_int32 rmax, l_int32 gmin, l_int32 gmax, l_int32 bmin, l_int32 bmax)
pixMaskOverColorRange()
l_ok getRGBFromIndex(l_uint32 index, l_int32 sigbits, l_int32 *prval, l_int32 *pgval, l_int32 *pbval)
getRGBFromIndex()
l_ok pixFindColorRegions(PIX *pixs, PIX *pixm, l_int32 factor, l_int32 lightthresh, l_int32 darkthresh, l_int32 mindiff, l_int32 colordiff, l_float32 edgefract, l_float32 *pcolorfract, PIX **pcolormask1, PIX **pcolormask2, PIXA *pixadb)
pixFindColorRegions()
l_ok makeRGBIndexTables(l_uint32 **prtab, l_uint32 **pgtab, l_uint32 **pbtab, l_int32 sigbits)
makeRGBIndexTables()
l_ok pixNumColors(PIX *pixs, l_int32 factor, l_int32 *pncolors)
pixNumColors()
PIX * pixMaskOverGrayPixels(PIX *pixs, l_int32 maxlimit, l_int32 satlimit)
pixMaskOverGrayPixels()
l_ok pixcmapHasColor(PIXCMAP *cmap, l_int32 *pcolor)
pixcmapHasColor()
l_int32 pixcmapGetCount(const PIXCMAP *cmap)
pixcmapGetCount()
PIXCMAP * pixcmapCreate(l_int32 depth)
pixcmapCreate()
l_ok pixcmapAddColor(PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval)
pixcmapAddColor()
l_ok pixNumberOccupiedOctcubes(PIX *pix, l_int32 level, l_int32 mincount, l_float32 minfract, l_int32 *pncolors)
pixNumberOccupiedOctcubes()
l_ok pixAssignToNearestColor(PIX *pixd, PIX *pixs, PIX *pixm, l_int32 level, l_int32 *countarray)
pixAssignToNearestColor()
BOXA * pixConnCompBB(PIX *pixs, l_int32 connectivity)
pixConnCompBB()
PIX * pixSobelEdgeFilter(PIX *pixs, l_int32 orientflag)
pixSobelEdgeFilter()
NUMA * numaGammaTRC(l_float32 gamma, l_int32 minval, l_int32 maxval)
numaGammaTRC()
void fpixDestroy(FPIX **pfpix)
fpixDestroy()
FPIX * pixComponentFunction(PIX *pix, l_float32 rnum, l_float32 gnum, l_float32 bnum, l_float32 rdenom, l_float32 gdenom, l_float32 bdenom)
pixComponentFunction()
PIX * fpixThresholdToPix(FPIX *fpix, l_float32 thresh)
fpixThresholdToPix()
PIX * pixThresholdToBinary(PIX *pixs, l_int32 thresh)
pixThresholdToBinary()
PIX * pixCloseSafeBrick(PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize)
pixCloseSafeBrick()
PIX * pixErodeBrick(PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize)
pixErodeBrick()
PIX * pixDilateBrick(PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize)
pixDilateBrick()
PIX * pixMorphSequence(PIX *pixs, const char *sequence, l_int32 dispsep)
pixMorphSequence()
void numaDestroy(NUMA **pna)
numaDestroy()
l_int32 numaGetCount(NUMA *na)
numaGetCount()
l_ok numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_int32 * numaGetIArray(NUMA *na)
numaGetIArray()
l_float32 * numaGetFArray(NUMA *na, l_int32 copyflag)
numaGetFArray()
NUMA * numaSortIndexAutoSelect(NUMA *nas, l_int32 sortorder)
numaSortIndexAutoSelect()
NUMA * numaMakeConstant(l_float32 val, l_int32 size)
numaMakeConstant()
l_uint32 * pixGetData(PIX *pix)
pixGetData()
l_ok pixSetColormap(PIX *pix, PIXCMAP *colormap)
pixSetColormap()
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 * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
PIX * pixClone(PIX *pixs)
pixClone()
PIX * pixGetRGBComponent(PIX *pixs, l_int32 comp)
pixGetRGBComponent()
l_ok pixSetAll(PIX *pix)
pixSetAll()
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 setLineDataVal(l_uint32 *line, l_int32 j, l_int32 d, l_uint32 val)
setLineDataVal()
PIX * pixInvert(PIX *pixd, PIX *pixs)
pixInvert()
l_ok pixCountPixels(PIX *pixs, l_int32 *pcount, l_int32 *tab8)
pixCountPixels()
PIX * pixOr(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixOr()
PIX * pixAnd(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixAnd()
l_ok pixSetMasked(PIX *pixd, PIX *pixm, l_uint32 val)
pixSetMasked()
l_ok pixForegroundFraction(PIX *pix, l_float32 *pfract)
pixForegroundFraction()
l_ok pixCombineMasked(PIX *pixd, PIX *pixs, PIX *pixm)
pixCombineMasked()
PIX * pixSubtract(PIX *pixd, PIX *pixs1, PIX *pixs2)
pixSubtract()
l_ok pixCountRGBColorsByHash(PIX *pixs, l_int32 *pncolors)
pixCountRGBColorsByHash()
PIX * pixDisplayColorArray(l_uint32 *carray, l_int32 ncolors, l_int32 side, l_int32 ncols, l_int32 fontsize)
pixDisplayColorArray()
NUMA * pixGetGrayHistogram(PIX *pixs, l_int32 factor)
pixGetGrayHistogram()
l_ok pixGetRankColorArray(PIX *pixs, l_int32 nbins, l_int32 type, l_int32 factor, l_uint32 **pcarray, PIXA *pixadb, l_int32 fontsize)
pixGetRankColorArray()
PIX * pixMakeSymmetricMask(l_int32 w, l_int32 h, l_float32 hf, l_float32 vf, l_int32 type)
pixSelectComponentBySize()
@ REMOVE_CMAP_TO_FULL_COLOR
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
PIX * pixConvertRGBToGrayMinMax(PIX *pixs, l_int32 type)
pixConvertRGBToGrayMinMax()
PIX * pixConvertRGBToGray(PIX *pixs, l_float32 rwt, l_float32 gwt, l_float32 bwt)
pixConvertRGBToGray()
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
PIX * pixConvertRGBToLuminance(PIX *pixs)
pixConvertRGBToLuminance()
PIX * pixConvertRGBToBinaryArb(PIX *pixs, l_float32 rc, l_float32 gc, l_float32 bc, l_int32 thresh, l_int32 relation)
pixConvertRGBToBinaryArb()
PIX * pixScaleAreaMap(PIX *pix, l_float32 scalex, l_float32 scaley)
pixScaleAreaMap()
PIX * pixScaleAreaMap2(PIX *pix)
pixScaleAreaMap2()
PIX * pixScaleByIntSampling(PIX *pixs, l_int32 factor)
pixScaleByIntSampling()
PIX * pixRemoveBorderConnComps(PIX *pixs, l_int32 connectivity)
pixRemoveBorderConnComps()