80 #include "allheaders.h" 104 l_int32 x1, y1, w1, h1, x2, y2, w2, h2;
106 PROCNAME(
"boxContains");
109 return ERROR_INT(
"&result not defined", procName, 1);
112 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
116 if (x1 <= x2 && y1 <= y2 && (x1 + w1 >= x2 + w2) && (y1 + h1 >= y2 + h2))
135 l_int32 l1, l2, r1, r2, t1, t2, b1, b2, w1, h1, w2, h2;
137 PROCNAME(
"boxIntersects");
140 return ERROR_INT(
"&result not defined", procName, 1);
143 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
151 if (b2 < t1 || b1 < t2 || r1 < l2 || r2 < l1)
180 PROCNAME(
"boxaContainedInBox");
183 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
185 return (
BOXA *)ERROR_PTR(
"box not defined", procName, NULL);
190 for (i = 0; i < n; i++) {
218 PROCNAME(
"boxaContainedInBoxCount");
221 return ERROR_INT(
"&count not defined", procName, 1);
224 return ERROR_INT(
"boxa not defined", procName, 1);
226 return ERROR_INT(
"box not defined", procName, 1);
230 for (i = 0; i < n; i++) {
254 l_int32 i, j, n1, n2, cont, result;
257 PROCNAME(
"boxaContainedInBoxa");
260 return ERROR_INT(
"&contained not defined", procName, 1);
262 if (!boxa1 || !boxa2)
263 return ERROR_INT(
"boxa1 and boxa2 not both defined", procName, 1);
267 for (i = 0; i < n2; i++) {
270 for (j = 0; j < n1; j++) {
310 PROCNAME(
"boxaIntersectsBox");
313 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
315 return (
BOXA *)ERROR_PTR(
"box not defined", procName, NULL);
320 for (i = 0; i < n; i++) {
348 PROCNAME(
"boxaIntersectsBoxCount");
351 return ERROR_INT(
"&count not defined", procName, 1);
354 return ERROR_INT(
"boxa not defined", procName, 1);
356 return ERROR_INT(
"box not defined", procName, 1);
360 for (i = 0; i < n; i++) {
392 PROCNAME(
"boxaClipToBox");
395 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
397 return (
BOXA *)ERROR_PTR(
"box not defined", procName, NULL);
402 for (i = 0; i < n; i++) {
444 l_int32 i, j, w, h, n1, n2, overlap, niters;
445 BOX *box1, *box2, *box3;
449 PROCNAME(
"boxaCombineOverlaps");
452 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
469 for (i = 0; i < n1; i++) {
472 for (j = i + 1; j < n1; j++) {
503 L_INFO(
"number of iterations: %d\n", procName, niters);
541 l_int32 i, j, w, h, w2, h2, n1, n2, n1i, n2i, niters;
542 l_int32 overlap, bigger, area1, area2;
543 BOX *box1, *box2, *box3;
544 BOXA *boxa1, *boxa2, *boxac1, *boxac2;
547 PROCNAME(
"boxaCombineOverlapsInPair");
549 if (pboxad1) *pboxad1 = NULL;
550 if (pboxad2) *pboxad2 = NULL;
551 if (!boxas1 || !boxas2)
552 return ERROR_INT(
"boxas1 and boxas2 not both defined", procName, 1);
553 if (!pboxad1 || !pboxad2)
554 return ERROR_INT(
"&boxad1 and &boxad2 not both defined", procName, 1);
566 if (area1 >= area2) {
594 for (i = 0; i < n1; i++) {
597 for (j = 0; j < n2; j++) {
602 if (overlap && (bigger == 1)) {
613 for (i = 0; i < n2; i++) {
616 for (j = 0; j < n1; j++) {
621 if (overlap && (bigger == 1)) {
640 if (n1 == n1i && n2 == n2i)
break;
653 L_INFO(
"number of iterations: %d\n", procName, niters);
676 l_int32 l1, l2, r1, r2, t1, t2, b1, b2, w1, h1, w2, h2, ld, td, rd, bd;
678 PROCNAME(
"boxOverlapRegion");
681 return (
BOX *)ERROR_PTR(
"box1 not defined", procName, NULL);
683 return (
BOX *)ERROR_PTR(
"box2 not defined", procName, NULL);
691 if (b2 < t1 || b1 < t2 || r1 < l2 || r2 < l1)
698 return boxCreate(ld, td, rd - ld + 1, bd - td + 1);
718 l_int32 l1, l2, r1, r2, t1, t2, b1, b2, w1, h1, w2, h2, ld, td, rd, bd;
720 PROCNAME(
"boxBoundingRegion");
723 return (
BOX *)ERROR_PTR(
"box1 not defined", procName, NULL);
725 return (
BOX *)ERROR_PTR(
"box2 not defined", procName, NULL);
737 return boxCreate(ld, td, rd - ld + 1, bd - td + 1);
759 l_int32 w2, h2, w, h;
762 PROCNAME(
"boxOverlapFraction");
765 return ERROR_INT(
"&fract not defined", procName, 1);
768 return ERROR_INT(
"box1 not defined", procName, 1);
770 return ERROR_INT(
"box2 not defined", procName, 1);
777 *pfract = (l_float32)(w * h) / (l_float32)(w2 * h2);
798 PROCNAME(
"boxOverlapArea");
801 return ERROR_INT(
"&area not defined", procName, 1);
804 return ERROR_INT(
"box1 not defined", procName, 1);
806 return ERROR_INT(
"box2 not defined", procName, 1);
856 l_float32 min_overlap,
860 l_int32 i, j, n, w, h, area1, area2, val;
861 l_int32 overlap_area;
862 l_float32 overlap_ratio, area_ratio;
863 BOX *box1, *box2, *box3;
867 PROCNAME(
"boxaHandleOverlaps");
869 if (pnamap) *pnamap = NULL;
871 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
873 return (
BOXA *)ERROR_PTR(
"invalid op", procName, NULL);
879 L_WARNING(
"range is 0\n", procName);
885 for (i = 0; i < n; i++) {
893 for (j = i + 1; j < i + 1 + range && j < n; j++) {
896 if (overlap_area > 0) {
901 }
else if (area1 >= area2) {
902 overlap_ratio = (l_float32)overlap_area / (l_float32)area2;
903 area_ratio = (l_float32)area2 / (l_float32)area1;
904 if (overlap_ratio >= min_overlap &&
905 area_ratio <= max_ratio) {
909 overlap_ratio = (l_float32)overlap_area / (l_float32)area1;
910 area_ratio = (l_float32)area1 / (l_float32)area2;
911 if (overlap_ratio >= min_overlap &&
912 area_ratio <= max_ratio) {
925 for (i = 0; i < n; i++) {
940 for (i = 0; i < n; i++) {
978 l_int32 l1, t1, w1, h1, r1, b1, l2, t2, w2, h2, r2, b2;
980 PROCNAME(
"boxSeparationDistance");
982 if (!ph_sep && !pv_sep)
983 return ERROR_INT(
"nothing to do", procName, 1);
984 if (ph_sep) *ph_sep = 0;
985 if (pv_sep) *pv_sep = 0;
987 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
1034 l_int32 w1, h1, w2, h2, size1, size2;
1036 PROCNAME(
"boxCompareSize");
1039 return ERROR_INT(
"&rel not defined", procName, 1);
1042 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
1046 return ERROR_INT(
"invalid compare type", procName, 1);
1051 *prel = (w1 > w2) ? 1 : ((w1 == w2) ? 0 : -1);
1053 *prel = (h1 > h2) ? 1 : ((h1 == h2) ? 0 : -1);
1055 size1 = L_MAX(w1, h1);
1056 size2 = L_MAX(w2, h2);
1057 *prel = (size1 > size2) ? 1 : ((size1 == size2) ? 0 : -1);
1061 *prel = (size1 > size2) ? 1 : ((size1 == size2) ? 0 : -1);
1065 *prel = (size1 > size2) ? 1 : ((size1 == size2) ? 0 : -1);
1085 l_int32 bx, by, bw, bh;
1087 PROCNAME(
"boxContainsPt");
1090 return ERROR_INT(
"&contains not defined", procName, 1);
1093 return ERROR_INT(
"&box not defined", procName, 1);
1095 if (x >= bx && x < bx + bw && y >= by && y < by + bh)
1119 l_int32 i, n, minindex;
1120 l_float32 delx, dely, dist, mindist, cx, cy;
1123 PROCNAME(
"boxaGetNearestToPt");
1126 return (
BOX *)ERROR_PTR(
"boxa not defined", procName, NULL);
1128 return (
BOX *)ERROR_PTR(
"n = 0", procName, NULL);
1130 mindist = 1000000000.;
1132 for (i = 0; i < n; i++) {
1135 delx = (l_float32)(cx - x);
1136 dely = (l_float32)(cy - y);
1137 dist = delx * delx + dely * dely;
1138 if (dist < mindist) {
1171 l_int32 i, n, minindex;
1172 l_float32 dist, mindist, cx, cy;
1175 PROCNAME(
"boxaGetNearestToLine");
1178 return (
BOX *)ERROR_PTR(
"boxa not defined", procName, NULL);
1180 return (
BOX *)ERROR_PTR(
"n = 0", procName, NULL);
1181 if (y >= 0 && x >= 0)
1182 return (
BOX *)ERROR_PTR(
"either x or y must be < 0", procName, NULL);
1184 return (
BOX *)ERROR_PTR(
"either x or y must be >= 0", procName, NULL);
1186 mindist = 1000000000.;
1188 for (i = 0; i < n; i++) {
1192 dist = L_ABS(cx - (l_float32)x);
1194 dist = L_ABS(cy - (l_float32)y);
1195 if (dist < mindist) {
1225 l_int32 dist_select,
1230 l_int32 i, n, index, dist;
1234 PROCNAME(
"boxaFindNearestBoxes");
1236 if (pnaaindex) *pnaaindex = NULL;
1237 if (pnaadist) *pnaadist = NULL;
1239 return ERROR_INT(
"&naaindex not defined", procName, 1);
1241 return ERROR_INT(
"&naadist not defined", procName, 1);
1243 return ERROR_INT(
"boxa not defined", procName, 1);
1250 for (i = 0; i < n; i++) {
1254 range, &index, &dist);
1258 range, &index, &dist);
1262 range, &index, &dist);
1266 range, &index, &dist);
1308 l_int32 dist_select,
1313 l_int32 j, jmin, jmax, n, mindist, dist, index;
1314 l_int32 x, y, w, h, bx, by, bw, bh;
1316 PROCNAME(
"boxaGetNearestByDirection");
1318 if (pindex) *pindex = -1;
1319 if (pdist) *pdist = 100000;
1321 return ERROR_INT(
"&index not defined", procName, 1);
1323 return ERROR_INT(
"&dist not defined", procName, 1);
1325 return ERROR_INT(
"boxa not defined", procName, 1);
1328 return ERROR_INT(
"invalid dir", procName, 1);
1330 return ERROR_INT(
"invalid dist_select", procName, 1);
1332 if (i < 0 || i >= n)
1333 return ERROR_INT(
"invalid box index", procName, 1);
1335 jmin = (range <= 0) ? 0 : L_MAX(0, i - range);
1336 jmax = (range <= 0) ? n - 1 : L_MIN(n -1, i + range);
1341 for (j = jmin; j <= jmax; j++) {
1342 if (j == i)
continue;
1350 if (dist < mindist) {
1357 for (j = jmin; j <= jmax; j++) {
1358 if (j == i)
continue;
1366 if (dist < mindist) {
1403 ovlp = c2 + s2 - 1 - c1;
1405 ovlp = c1 + s1 - 1 - c2;
1406 return (ovlp < 0) ? 0 : 1;
1429 dist = c1 - (c2 + s2 - 1);
1431 dist = c2 - (c1 + s1 - 1);
1450 PROCNAME(
"boxGetCenter");
1455 return ERROR_INT(
"&cx, &cy not both defined", procName, 1);
1457 return ERROR_INT(
"box not defined", procName, 1);
1459 *pcx = (l_float32)(x + 0.5 * w);
1460 *pcy = (l_float32)(y + 0.5 * h);
1495 l_int32 bx, by, bw, bh, xp, yp, xt, yt, i, n;
1499 PROCNAME(
"boxIntersectByLine");
1506 if (!px1 || !py1 || !px2 || !py2)
1507 return ERROR_INT(
"&x1, &y1, &x2, &y2 not all defined", procName, 1);
1509 return ERROR_INT(
"&n not defined", procName, 1);
1511 return ERROR_INT(
"box not defined", procName, 1);
1515 if (y >= by && y < by + bh) {
1523 if (slope > 1000000.0) {
1524 if (x >= bx && x < bx + bw) {
1534 invslope = 1.0 / slope;
1535 xp = (l_int32)(x + invslope * (y - by));
1536 if (xp >= bx && xp < bx + bw)
1538 xp = (l_int32)(x + invslope * (y - by - bh + 1));
1539 if (xp >= bx && xp < bx + bw)
1543 yp = (l_int32)(y + slope * (x - bx));
1544 if (yp >= by && yp < by + bh)
1546 yp = (l_int32)(y + slope * (x - bx - bw + 1));
1547 if (yp >= by && yp < by + bh)
1556 for (i = 1; i < n; i++) {
1558 if ((*px1 != xt) || (*py1 != yt)) {
1593 PROCNAME(
"boxClipToRectangle");
1596 return (
BOX *)ERROR_PTR(
"box not defined", procName, NULL);
1597 if (box->
x >= wi || box->
y >= hi ||
1598 box->
x + box->
w <= 0 || box->
y + box->
h <= 0)
1599 return (
BOX *)ERROR_PTR(
"box outside rectangle", procName, NULL);
1610 if (boxd->
x + boxd->
w > wi)
1611 boxd->
w = wi - boxd->
x;
1612 if (boxd->
y + boxd->
h > hi)
1613 boxd->
h = hi - boxd->
y;
1657 PROCNAME(
"boxClipToRectangleParams");
1659 if (pxstart) *pxstart = 0;
1660 if (pystart) *pystart = 0;
1661 if (pxend) *pxend = w;
1662 if (pyend) *pyend = h;
1665 if (!pxstart || !pystart || !pxend || !pyend)
1666 return ERROR_INT(
"invalid ptr input", procName, 1);
1670 return ERROR_INT(
"box outside image", procName, 1);
1676 if (bw == 0 || bh == 0)
1677 return ERROR_INT(
"invalid clipping box", procName, 1);
1678 *pxend = *pxstart + bw;
1679 *pyend = *pystart + bh;
1713 PROCNAME(
"boxRelocateOneSide");
1716 return (
BOX *)ERROR_PTR(
"boxs not defined", procName, NULL);
1760 PROCNAME(
"boxaAdjustSides");
1763 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
1767 for (i = 0; i < n; i++) {
1769 box2 =
boxAdjustSides(NULL, box1, delleft, delright, deltop, delbot);
1814 l_int32 x, y, w, h, xl, xr, yt, yb, wnew, hnew;
1816 PROCNAME(
"boxAdjustSides");
1819 return (
BOX *)ERROR_PTR(
"boxs not defined", procName, NULL);
1822 xl = L_MAX(0, x + delleft);
1823 yt = L_MAX(0, y + deltop);
1824 xr = x + w + delright;
1825 yb = y + h + delbot;
1829 if (wnew < 1 || hnew < 1)
1830 return (
BOX *)ERROR_PTR(
"boxd has 0 area", procName, NULL);
1868 PROCNAME(
"boxaSetSide");
1871 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
1872 if (boxad && (boxas != boxad))
1873 return (
BOXA *)ERROR_PTR(
"not in-place", procName, NULL);
1876 return (
BOXA *)ERROR_PTR(
"invalid side", procName, NULL);
1878 return (
BOXA *)ERROR_PTR(
"val < 0", procName, NULL);
1883 for (i = 0; i < n; i++) {
1914 l_int32 x, y, w, h, diff;
1916 PROCNAME(
"boxSetSide");
1919 return ERROR_INT(
"box not defined", procName, 1);
1922 return ERROR_INT(
"invalid side", procName, 1);
1924 return ERROR_INT(
"val < 0", procName, 1);
1929 if (L_ABS(diff) >= thresh)
1932 diff = x + w -1 - val;
1933 if (L_ABS(diff) >= thresh)
1937 if (L_ABS(diff) >= thresh)
1940 diff = y + h - 1 - val;
1941 if (L_ABS(diff) >= thresh)
1977 l_int32 x, y, w, h, n, i, diff;
1980 PROCNAME(
"boxaAdjustWidthToTarget");
1983 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
1984 if (boxad && (boxas != boxad))
1985 return (
BOXA *)ERROR_PTR(
"not in-place", procName, NULL);
1988 return (
BOXA *)ERROR_PTR(
"invalid sides", procName, NULL);
1990 return (
BOXA *)ERROR_PTR(
"target < 1", procName, NULL);
1995 for (i = 0; i < n; i++) {
2000 if (L_ABS(diff) >= thresh)
2003 if (L_ABS(diff) >= thresh)
2006 if (L_ABS(diff) >= thresh)
2044 l_int32 x, y, w, h, n, i, diff;
2047 PROCNAME(
"boxaAdjustHeightToTarget");
2050 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
2051 if (boxad && (boxas != boxad))
2052 return (
BOXA *)ERROR_PTR(
"not in-place", procName, NULL);
2055 return (
BOXA *)ERROR_PTR(
"invalid sides", procName, NULL);
2057 return (
BOXA *)ERROR_PTR(
"target < 1", procName, NULL);
2062 for (i = 0; i < n; i++) {
2065 if (w == 0 || h == 0) {
2071 if (L_ABS(diff) >= thresh)
2074 if (L_ABS(diff) >= thresh)
2077 if (L_ABS(diff) >= thresh)
2100 PROCNAME(
"boxEqual");
2103 return ERROR_INT(
"&same not defined", procName, 1);
2106 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
2107 if (box1->
x == box2->
x && box1->
y == box2->
y &&
2108 box1->
w == box2->
w && box1->
h == box2->
h)
2149 l_int32 i, j, n, jstart, jend, found, samebox;
2150 l_int32 *countarray;
2154 PROCNAME(
"boxaEqual");
2156 if (pnaindex) *pnaindex = NULL;
2158 return ERROR_INT(
"&same not defined", procName, 1);
2160 if (!boxa1 || !boxa2)
2161 return ERROR_INT(
"boxa1 and boxa2 not both defined", procName, 1);
2166 if ((countarray = (l_int32 *)LEPT_CALLOC(n,
sizeof(l_int32))) == NULL)
2167 return ERROR_INT(
"calloc fail for countarray", procName, 1);
2170 for (i = 0; i < n; i++) {
2172 jstart = L_MAX(0, i - maxdist);
2173 jend = L_MIN(n-1, i + maxdist);
2175 for (j = jstart; j <= jend; j++) {
2178 if (samebox && countarray[j] == 0) {
2190 LEPT_FREE(countarray);
2200 LEPT_FREE(countarray);
2230 l_int32 l1, l2, r1, r2, t1, t2, b1, b2;
2232 PROCNAME(
"boxSimilar");
2235 return ERROR_INT(
"&similar not defined", procName, 1);
2238 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
2242 if (L_ABS(l1 - l2) > leftdiff)
2244 if (L_ABS(r1 - r2) > rightdiff)
2246 if (L_ABS(t1 - t2) > topdiff)
2248 if (L_ABS(b1 - b2) > botdiff)
2287 l_int32 i, n1, n2, match, mismatch;
2290 PROCNAME(
"boxaSimilar");
2292 if (psimilar) *psimilar = 0;
2293 if (pnasim) *pnasim = NULL;
2294 if (!boxa1 || !boxa2)
2295 return ERROR_INT(
"boxa1 and boxa2 not both defined", procName, 1);
2297 return ERROR_INT(
"&similar not defined", procName, 1);
2301 L_ERROR(
"boxa counts differ: %d vs %d\n", procName, n1, n2);
2307 for (i = 0; i < n1; i++) {
2310 boxSimilar(box1, box2, leftdiff, rightdiff, topdiff, botdiff,
2318 if (!debug && pnasim == NULL)
2321 L_INFO(
"box %d not similar\n", procName, i);
2325 if (!mismatch) *psimilar = 1;
2359 PROCNAME(
"boxaJoin");
2362 return ERROR_INT(
"boxad not defined", procName, 1);
2368 if (iend < 0 || iend >= n)
2371 return ERROR_INT(
"istart > iend; nothing to add", procName, 1);
2373 for (i = istart; i <= iend; i++) {
2408 PROCNAME(
"boxaaJoin");
2411 return ERROR_INT(
"baad not defined", procName, 1);
2418 if (iend < 0 || iend >= n)
2421 return ERROR_INT(
"istart > iend; nothing to add", procName, 1);
2423 for (i = istart; i <= iend; i++) {
2458 PROCNAME(
"boxaSplitEvenOdd");
2460 if (pboxae) *pboxae = NULL;
2461 if (pboxao) *pboxao = NULL;
2462 if (!pboxae || !pboxao)
2463 return ERROR_INT(
"&boxae and &boxao not both defined", procName, 1);
2465 return ERROR_INT(
"boxa not defined", procName, 1);
2470 if (fillflag == 0) {
2472 for (i = 0; i < n; i++) {
2480 for (i = 0; i < n; i++) {
2518 l_int32 i, n, ne, no;
2522 PROCNAME(
"boxaMergeEvenOdd");
2524 if (!boxae || !boxao)
2525 return (
BOXA *)ERROR_PTR(
"boxae and boxao not defined", procName, NULL);
2528 if (ne < no || ne > no + 1)
2529 return (
BOXA *)ERROR_PTR(
"boxa sizes invalid", procName, NULL);
2532 if (fillflag == 0) {
2534 for (i = 0; i < n; i++) {
2542 for (i = 0; i < ne; i++) {
BOXA * boxaIntersectsBox(BOXA *boxas, BOX *box)
boxaIntersectsBox()
BOX * boxaGetNearestToPt(BOXA *boxa, l_int32 x, l_int32 y)
boxaGetNearestToPt()
l_ok boxaEqual(BOXA *boxa1, BOXA *boxa2, l_int32 maxdist, NUMA **pnaindex, l_int32 *psame)
boxaEqual()
BOX * boxaGetValidBox(BOXA *boxa, l_int32 index, l_int32 accessflag)
boxaGetValidBox()
l_ok boxaJoin(BOXA *boxad, BOXA *boxas, l_int32 istart, l_int32 iend)
boxaJoin()
l_ok boxaCombineOverlapsInPair(BOXA *boxas1, BOXA *boxas2, BOXA **pboxad1, BOXA **pboxad2, PIXA *pixadb)
boxaCombineOverlapsInPair()
BOXA * boxaMergeEvenOdd(BOXA *boxae, BOXA *boxao, l_int32 fillflag)
boxaMergeEvenOdd()
l_ok ptaAddPt(PTA *pta, l_float32 x, l_float32 y)
ptaAddPt()
l_ok numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
l_ok boxContainsPt(BOX *box, l_float32 x, l_float32 y, l_int32 *pcontains)
boxContainsPt()
l_int32 boxaaGetCount(BOXAA *baa)
boxaaGetCount()
l_ok boxaContainedInBoxCount(BOXA *boxa, BOX *box, l_int32 *pcount)
boxaContainedInBoxCount()
static l_int32 boxGetDistanceInXorY(l_int32 c1, l_int32 s1, l_int32 c2, l_int32 s2)
boxGetDistanceInXorY()
PTA * ptaCreate(l_int32 n)
ptaCreate()
l_ok boxGetSideLocations(BOX *box, l_int32 *pl, l_int32 *pr, l_int32 *pt, l_int32 *pb)
boxGetSideLocations()
l_ok boxaSplitEvenOdd(BOXA *boxa, l_int32 fillflag, BOXA **pboxae, BOXA **pboxao)
boxaSplitEvenOdd()
NUMA * numaMakeConstant(l_float32 val, l_int32 size)
numaMakeConstant()
BOXA * boxaContainedInBox(BOXA *boxas, BOX *box)
boxaContainedInBox()
l_ok boxaReplaceBox(BOXA *boxa, l_int32 index, BOX *box)
boxaReplaceBox()
BOX * boxClipToRectangle(BOX *box, l_int32 wi, l_int32 hi)
boxClipToRectangle()
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
l_ok pixSetAll(PIX *pix)
pixSetAll()
l_ok boxGetCenter(BOX *box, l_float32 *pcx, l_float32 *pcy)
boxGetCenter()
BOXA * boxaCopy(BOXA *boxa, l_int32 copyflag)
boxaCopy()
NUMA * numaCreate(l_int32 n)
numaCreate()
l_int32 ptaGetCount(PTA *pta)
ptaGetCount()
void boxaDestroy(BOXA **pboxa)
boxaDestroy()
BOXA * boxaAdjustHeightToTarget(BOXA *boxad, BOXA *boxas, l_int32 sides, l_int32 target, l_int32 thresh)
boxaAdjustHeightToTarget()
BOXA * boxaHandleOverlaps(BOXA *boxas, l_int32 op, l_int32 range, l_float32 min_overlap, l_float32 max_ratio, NUMA **pnamap)
boxaHandleOverlaps()
NUMAA * numaaCreate(l_int32 n)
numaaCreate()
BOX * boxBoundingRegion(BOX *box1, BOX *box2)
boxBoundingRegion()
l_ok numaSetValue(NUMA *na, l_int32 index, l_float32 val)
numaSetValue()
BOXA * boxaClipToBox(BOXA *boxas, BOX *box)
boxaClipToBox()
static l_int32 boxHasOverlapInXorY(l_int32 c1, l_int32 s1, l_int32 c2, l_int32 s2)
boxHasOverlapInXorY()
l_ok boxSeparationDistance(BOX *box1, BOX *box2, l_int32 *ph_sep, l_int32 *pv_sep)
boxSeparationDistance()
l_ok boxaaJoin(BOXAA *baad, BOXAA *baas, l_int32 istart, l_int32 iend)
boxaaJoin()
l_ok boxaaAddBoxa(BOXAA *baa, BOXA *ba, l_int32 copyflag)
boxaaAddBoxa()
l_ok boxOverlapArea(BOX *box1, BOX *box2, l_int32 *parea)
boxOverlapArea()
l_ok numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_ok pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
l_ok boxaGetBoxGeometry(BOXA *boxa, l_int32 index, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxaGetBoxGeometry()
BOXA * boxaSaveValid(BOXA *boxas, l_int32 copyflag)
boxaSaveValid()
l_ok boxaFindNearestBoxes(BOXA *boxa, l_int32 dist_select, l_int32 range, NUMAA **pnaaindex, NUMAA **pnaadist)
boxaFindNearestBoxes()
l_ok boxaGetArea(BOXA *boxa, l_int32 *parea)
boxaGetArea()
l_ok boxSimilar(BOX *box1, BOX *box2, l_int32 leftdiff, l_int32 rightdiff, l_int32 topdiff, l_int32 botdiff, l_int32 *psimilar)
boxSimilar()
l_ok boxaAddBox(BOXA *boxa, BOX *box, l_int32 copyflag)
boxaAddBox()
l_ok boxContains(BOX *box1, BOX *box2, l_int32 *presult)
boxContains()
BOX * boxAdjustSides(BOX *boxd, BOX *boxs, l_int32 delleft, l_int32 delright, l_int32 deltop, l_int32 delbot)
boxAdjustSides()
l_ok boxSetSide(BOX *boxs, l_int32 side, l_int32 val, l_int32 thresh)
boxSetSide()
l_ok boxOverlapFraction(BOX *box1, BOX *box2, l_float32 *pfract)
boxOverlapFraction()
BOXA * boxaSetSide(BOXA *boxad, BOXA *boxas, l_int32 side, l_int32 val, l_int32 thresh)
boxaSetSide()
BOX * boxOverlapRegion(BOX *box1, BOX *box2)
boxOverlapRegion()
void pixDestroy(PIX **ppix)
pixDestroy()
BOX * boxaGetBox(BOXA *boxa, l_int32 index, l_int32 accessflag)
boxaGetBox()
l_ok boxaIntersectsBoxCount(BOXA *boxa, BOX *box, l_int32 *pcount)
boxaIntersectsBoxCount()
l_ok boxCompareSize(BOX *box1, BOX *box2, l_int32 type, l_int32 *prel)
boxCompareSize()
l_ok boxaGetExtent(BOXA *boxa, l_int32 *pw, l_int32 *ph, BOX **pbox)
boxaGetExtent()
void numaDestroy(NUMA **pna)
numaDestroy()
BOX * boxRelocateOneSide(BOX *boxd, BOX *boxs, l_int32 loc, l_int32 sideflag)
boxRelocateOneSide()
BOXA * boxaAdjustSides(BOXA *boxas, l_int32 delleft, l_int32 delright, l_int32 deltop, l_int32 delbot)
boxaAdjustSides()
l_ok boxClipToRectangleParams(BOX *box, l_int32 w, l_int32 h, l_int32 *pxstart, l_int32 *pystart, l_int32 *pxend, l_int32 *pyend, l_int32 *pbw, l_int32 *pbh)
boxClipToRectangleParams()
l_ok pixRenderBoxaArb(PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderBoxaArb()
BOX * boxaGetNearestToLine(BOXA *boxa, l_int32 x, l_int32 y)
boxaGetNearestToLine()
BOXA * boxaAdjustWidthToTarget(BOXA *boxad, BOXA *boxas, l_int32 sides, l_int32 target, l_int32 thresh)
boxaAdjustWidthToTarget()
l_ok boxaContainedInBoxa(BOXA *boxa1, BOXA *boxa2, l_int32 *pcontained)
boxaContainedInBoxa()
l_ok boxIntersectByLine(BOX *box, l_int32 x, l_int32 y, l_float32 slope, l_int32 *px1, l_int32 *py1, l_int32 *px2, l_int32 *py2, l_int32 *pn)
boxIntersectByLine()
BOXA * boxaCombineOverlaps(BOXA *boxas, PIXA *pixadb)
boxaCombineOverlaps()
l_ok boxaSimilar(BOXA *boxa1, BOXA *boxa2, l_int32 leftdiff, l_int32 rightdiff, l_int32 topdiff, l_int32 botdiff, l_int32 debug, l_int32 *psimilar, NUMA **pnasim)
boxaSimilar()
BOX * boxCopy(BOX *box)
boxCopy()
void ptaDestroy(PTA **ppta)
ptaDestroy()
l_ok boxEqual(BOX *box1, BOX *box2, l_int32 *psame)
boxEqual()
l_ok boxaGetNearestByDirection(BOXA *boxa, l_int32 i, l_int32 dir, l_int32 dist_select, l_int32 range, l_int32 *pindex, l_int32 *pdist)
boxaGetNearestByDirection()
BOXA * boxaCreate(l_int32 n)
boxaCreate()
l_ok numaReplaceNumber(NUMA *na, l_int32 index, l_float32 val)
numaReplaceNumber()
void boxDestroy(BOX **pbox)
boxDestroy()
l_ok boxIntersects(BOX *box1, BOX *box2, l_int32 *presult)
boxIntersects()
l_int32 boxaGetCount(BOXA *boxa)
boxaGetCount()
l_ok ptaGetIPt(PTA *pta, l_int32 index, l_int32 *px, l_int32 *py)
ptaGetIPt()
l_ok boxSetGeometry(BOX *box, l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxSetGeometry()
l_ok boxGetGeometry(BOX *box, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxGetGeometry()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
l_ok numaaAddNuma(NUMAA *naa, NUMA *na, l_int32 copyflag)
numaaAddNuma()
BOXA * boxaaGetBoxa(BOXAA *baa, l_int32 index, l_int32 accessflag)
boxaaGetBoxa()