79 #include "allheaders.h" 103 l_int32 x1, y1, w1, h1, x2, y2, w2, h2;
105 PROCNAME(
"boxContains");
108 return ERROR_INT(
"&result not defined", procName, 1);
111 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
115 if (x1 <= x2 && y1 <= y2 && (x1 + w1 >= x2 + w2) && (y1 + h1 >= y2 + h2))
134 l_int32 l1, l2, r1, r2, t1, t2, b1, b2, w1, h1, w2, h2;
136 PROCNAME(
"boxIntersects");
139 return ERROR_INT(
"&result not defined", procName, 1);
142 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
150 if (b2 < t1 || b1 < t2 || r1 < l2 || r2 < l1)
179 PROCNAME(
"boxaContainedInBox");
182 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
184 return (
BOXA *)ERROR_PTR(
"box not defined", procName, NULL);
189 for (i = 0; i < n; i++) {
217 PROCNAME(
"boxaContainedInBoxCount");
220 return ERROR_INT(
"&count not defined", procName, 1);
223 return ERROR_INT(
"boxa not defined", procName, 1);
225 return ERROR_INT(
"box not defined", procName, 1);
229 for (i = 0; i < n; i++) {
253 l_int32 i, j, n1, n2, cont, result;
256 PROCNAME(
"boxaContainedInBoxa");
259 return ERROR_INT(
"&contained not defined", procName, 1);
261 if (!boxa1 || !boxa2)
262 return ERROR_INT(
"boxa1 and boxa2 not both defined", procName, 1);
266 for (i = 0; i < n2; i++) {
269 for (j = 0; j < n1; j++) {
309 PROCNAME(
"boxaIntersectsBox");
312 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
314 return (
BOXA *)ERROR_PTR(
"box not defined", procName, NULL);
319 for (i = 0; i < n; i++) {
347 PROCNAME(
"boxaIntersectsBoxCount");
350 return ERROR_INT(
"&count not defined", procName, 1);
353 return ERROR_INT(
"boxa not defined", procName, 1);
355 return ERROR_INT(
"box not defined", procName, 1);
359 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++) {
445 l_int32 i, j, w, h, n1, n2, overlap, niters;
446 BOX *box1, *box2, *box3;
450 PROCNAME(
"boxaCombineOverlaps");
453 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
470 for (i = 0; i < n1; i++) {
473 for (j = i + 1; j < n1; j++) {
504 L_INFO(
"number of iterations: %d\n", procName, niters);
542 l_int32 i, j, w, h, w2, h2, n1, n2, n1i, n2i, niters;
543 l_int32 overlap, bigger, area1, area2;
544 BOX *box1, *box2, *box3;
545 BOXA *boxa1, *boxa2, *boxac1, *boxac2;
548 PROCNAME(
"boxaCombineOverlapsInPair");
550 if (pboxad1) *pboxad1 = NULL;
551 if (pboxad2) *pboxad2 = NULL;
552 if (!boxas1 || !boxas2)
553 return ERROR_INT(
"boxas1 and boxas2 not both defined", procName, 1);
554 if (!pboxad1 || !pboxad2)
555 return ERROR_INT(
"&boxad1 and &boxad2 not both defined", procName, 1);
567 if (area1 >= area2) {
595 for (i = 0; i < n1; i++) {
598 for (j = 0; j < n2; j++) {
603 if (overlap && (bigger == 1)) {
614 for (i = 0; i < n2; i++) {
617 for (j = 0; j < n1; j++) {
622 if (overlap && (bigger == 1)) {
641 if (n1 == n1i && n2 == n2i)
break;
654 L_INFO(
"number of iterations: %d\n", procName, niters);
677 l_int32 l1, l2, r1, r2, t1, t2, b1, b2, w1, h1, w2, h2, ld, td, rd, bd;
679 PROCNAME(
"boxOverlapRegion");
682 return (
BOX *)ERROR_PTR(
"box1 not defined", procName, NULL);
684 return (
BOX *)ERROR_PTR(
"box2 not defined", procName, NULL);
692 if (b2 < t1 || b1 < t2 || r1 < l2 || r2 < l1)
699 return boxCreate(ld, td, rd - ld + 1, bd - td + 1);
719 l_int32 l1, l2, r1, r2, t1, t2, b1, b2, w1, h1, w2, h2, ld, td, rd, bd;
721 PROCNAME(
"boxBoundingRegion");
724 return (
BOX *)ERROR_PTR(
"box1 not defined", procName, NULL);
726 return (
BOX *)ERROR_PTR(
"box2 not defined", procName, NULL);
738 return boxCreate(ld, td, rd - ld + 1, bd - td + 1);
760 l_int32 w2, h2, w, h;
763 PROCNAME(
"boxOverlapFraction");
766 return ERROR_INT(
"&fract not defined", procName, 1);
769 return ERROR_INT(
"box1 not defined", procName, 1);
771 return ERROR_INT(
"box2 not defined", procName, 1);
778 *pfract = (l_float32)(w * h) / (l_float32)(w2 * h2);
799 PROCNAME(
"boxOverlapArea");
802 return ERROR_INT(
"&area not defined", procName, 1);
805 return ERROR_INT(
"box1 not defined", procName, 1);
807 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);
1865 l_int32 x, y, w, h, n, i, diff;
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++) {
1888 if (L_ABS(diff) >= thresh)
1891 diff = x + w -1 - val;
1892 if (L_ABS(diff) >= thresh)
1896 if (L_ABS(diff) >= thresh)
1899 diff = y + h - 1 - val;
1900 if (L_ABS(diff) >= thresh)
1938 l_int32 x, y, w, h, n, i, diff;
1941 PROCNAME(
"boxaAdjustWidthToTarget");
1944 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
1945 if (boxad && (boxas != boxad))
1946 return (
BOXA *)ERROR_PTR(
"not in-place", procName, NULL);
1949 return (
BOXA *)ERROR_PTR(
"invalid sides", procName, NULL);
1951 return (
BOXA *)ERROR_PTR(
"target < 1", procName, NULL);
1956 for (i = 0; i < n; i++) {
1961 if (L_ABS(diff) >= thresh)
1964 if (L_ABS(diff) >= thresh)
1967 if (L_ABS(diff) >= thresh)
2005 l_int32 x, y, w, h, n, i, diff;
2008 PROCNAME(
"boxaAdjustHeightToTarget");
2011 return (
BOXA *)ERROR_PTR(
"boxas not defined", procName, NULL);
2012 if (boxad && (boxas != boxad))
2013 return (
BOXA *)ERROR_PTR(
"not in-place", procName, NULL);
2016 return (
BOXA *)ERROR_PTR(
"invalid sides", procName, NULL);
2018 return (
BOXA *)ERROR_PTR(
"target < 1", procName, NULL);
2023 for (i = 0; i < n; i++) {
2026 if (w == 0 || h == 0) {
2032 if (L_ABS(diff) >= thresh)
2035 if (L_ABS(diff) >= thresh)
2038 if (L_ABS(diff) >= thresh)
2061 PROCNAME(
"boxEqual");
2064 return ERROR_INT(
"&same not defined", procName, 1);
2067 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
2068 if (box1->
x == box2->
x && box1->
y == box2->
y &&
2069 box1->
w == box2->
w && box1->
h == box2->
h)
2110 l_int32 i, j, n, jstart, jend, found, samebox;
2111 l_int32 *countarray;
2115 PROCNAME(
"boxaEqual");
2117 if (pnaindex) *pnaindex = NULL;
2119 return ERROR_INT(
"&same not defined", procName, 1);
2121 if (!boxa1 || !boxa2)
2122 return ERROR_INT(
"boxa1 and boxa2 not both defined", procName, 1);
2127 if ((countarray = (l_int32 *)LEPT_CALLOC(n,
sizeof(l_int32))) == NULL)
2128 return ERROR_INT(
"calloc fail for countarray", procName, 1);
2131 for (i = 0; i < n; i++) {
2133 jstart = L_MAX(0, i - maxdist);
2134 jend = L_MIN(n-1, i + maxdist);
2136 for (j = jstart; j <= jend; j++) {
2139 if (samebox && countarray[j] == 0) {
2151 LEPT_FREE(countarray);
2161 LEPT_FREE(countarray);
2191 l_int32 l1, l2, r1, r2, t1, t2, b1, b2;
2193 PROCNAME(
"boxSimilar");
2196 return ERROR_INT(
"&similar not defined", procName, 1);
2199 return ERROR_INT(
"box1 and box2 not both defined", procName, 1);
2203 if (L_ABS(l1 - l2) > leftdiff)
2205 if (L_ABS(r1 - r2) > rightdiff)
2207 if (L_ABS(t1 - t2) > topdiff)
2209 if (L_ABS(b1 - b2) > botdiff)
2248 l_int32 i, n1, n2, match, mismatch;
2251 PROCNAME(
"boxaSimilar");
2253 if (psimilar) *psimilar = 0;
2254 if (pnasim) *pnasim = NULL;
2255 if (!boxa1 || !boxa2)
2256 return ERROR_INT(
"boxa1 and boxa2 not both defined", procName, 1);
2258 return ERROR_INT(
"&similar not defined", procName, 1);
2262 L_ERROR(
"boxa counts differ: %d vs %d\n", procName, n1, n2);
2268 for (i = 0; i < n1; i++) {
2271 boxSimilar(box1, box2, leftdiff, rightdiff, topdiff, botdiff,
2279 if (!debug && pnasim == NULL)
2282 L_INFO(
"box %d not similar\n", procName, i);
2286 if (!mismatch) *psimilar = 1;
2320 PROCNAME(
"boxaJoin");
2323 return ERROR_INT(
"boxad not defined", procName, 1);
2329 if (iend < 0 || iend >= n)
2332 return ERROR_INT(
"istart > iend; nothing to add", procName, 1);
2334 for (i = istart; i <= iend; i++) {
2369 PROCNAME(
"boxaaJoin");
2372 return ERROR_INT(
"baad not defined", procName, 1);
2379 if (iend < 0 || iend >= n)
2382 return ERROR_INT(
"istart > iend; nothing to add", procName, 1);
2384 for (i = istart; i <= iend; i++) {
2419 PROCNAME(
"boxaSplitEvenOdd");
2421 if (pboxae) *pboxae = NULL;
2422 if (pboxao) *pboxao = NULL;
2423 if (!pboxae || !pboxao)
2424 return ERROR_INT(
"&boxae and &boxao not both defined", procName, 1);
2426 return ERROR_INT(
"boxa not defined", procName, 1);
2431 if (fillflag == 0) {
2433 for (i = 0; i < n; i++) {
2441 for (i = 0; i < n; i++) {
2479 l_int32 i, n, ne, no;
2483 PROCNAME(
"boxaMergeEvenOdd");
2485 if (!boxae || !boxao)
2486 return (
BOXA *)ERROR_PTR(
"boxae and boxao not defined", procName, NULL);
2489 if (ne < no || ne > no + 1)
2490 return (
BOXA *)ERROR_PTR(
"boxa sizes invalid", procName, NULL);
2493 if (fillflag == 0) {
2495 for (i = 0; i < n; i++) {
2503 for (i = 0; i < ne; i++) {
BOXA * boxaIntersectsBox(BOXA *boxas, BOX *box)
boxaIntersectsBox()
BOX * boxaGetNearestToPt(BOXA *boxa, l_int32 x, l_int32 y)
boxaGetNearestToPt()
BOX * boxaGetValidBox(BOXA *boxa, l_int32 index, l_int32 accessflag)
boxaGetValidBox()
l_int32 boxSeparationDistance(BOX *box1, BOX *box2, l_int32 *ph_sep, l_int32 *pv_sep)
boxSeparationDistance()
l_int32 numaAddNumber(NUMA *na, l_float32 val)
numaAddNumber()
l_int32 boxContains(BOX *box1, BOX *box2, l_int32 *presult)
boxContains()
BOXA * boxaMergeEvenOdd(BOXA *boxae, BOXA *boxao, l_int32 fillflag)
boxaMergeEvenOdd()
l_int32 ptaAddPt(PTA *pta, l_float32 x, l_float32 y)
ptaAddPt()
l_int32 boxaaGetCount(BOXAA *baa)
boxaaGetCount()
l_int32 boxSimilar(BOX *box1, BOX *box2, l_int32 leftdiff, l_int32 rightdiff, l_int32 topdiff, l_int32 botdiff, l_int32 *psimilar)
boxSimilar()
l_int32 boxaEqual(BOXA *boxa1, BOXA *boxa2, l_int32 maxdist, NUMA **pnaindex, l_int32 *psame)
boxaEqual()
static l_int32 boxGetDistanceInXorY(l_int32 c1, l_int32 s1, l_int32 c2, l_int32 s2)
boxGetDistanceInXorY()
PTA * ptaCreate(l_int32 n)
ptaCreate()
l_int32 boxCompareSize(BOX *box1, BOX *box2, l_int32 type, l_int32 *prel)
boxCompareSize()
NUMA * numaMakeConstant(l_float32 val, l_int32 size)
numaMakeConstant()
l_int32 boxSetGeometry(BOX *box, l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxSetGeometry()
l_int32 boxaAddBox(BOXA *boxa, BOX *box, l_int32 copyflag)
boxaAddBox()
BOXA * boxaContainedInBox(BOXA *boxas, BOX *box)
boxaContainedInBox()
l_int32 boxContainsPt(BOX *box, l_float32 x, l_float32 y, l_int32 *pcontains)
boxContainsPt()
l_int32 boxOverlapFraction(BOX *box1, BOX *box2, l_float32 *pfract)
boxOverlapFraction()
BOX * boxClipToRectangle(BOX *box, l_int32 wi, l_int32 hi)
boxClipToRectangle()
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
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()
l_int32 pixRenderBoxaArb(PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval)
pixRenderBoxaArb()
l_int32 boxaJoin(BOXA *boxad, BOXA *boxas, l_int32 istart, l_int32 iend)
boxaJoin()
l_int32 boxaContainedInBoxa(BOXA *boxa1, BOXA *boxa2, l_int32 *pcontained)
boxaContainedInBoxa()
l_int32 boxaGetBoxGeometry(BOXA *boxa, l_int32 index, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxaGetBoxGeometry()
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()
BOXA * boxaClipToBox(BOXA *boxas, BOX *box)
boxaClipToBox()
l_int32 numaaAddNuma(NUMAA *naa, NUMA *na, l_int32 copyflag)
numaaAddNuma()
static l_int32 boxHasOverlapInXorY(l_int32 c1, l_int32 s1, l_int32 c2, l_int32 s2)
boxHasOverlapInXorY()
l_int32 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()
l_int32 boxEqual(BOX *box1, BOX *box2, l_int32 *psame)
boxEqual()
static const l_int32 L_INSERT
l_int32 boxGetCenter(BOX *box, l_float32 *pcx, l_float32 *pcy)
boxGetCenter()
l_int32 boxaIntersectsBoxCount(BOXA *boxa, BOX *box, l_int32 *pcount)
boxaIntersectsBoxCount()
l_int32 boxaGetArea(BOXA *boxa, l_int32 *parea)
boxaGetArea()
l_int32 pixaAddPix(PIXA *pixa, PIX *pix, l_int32 copyflag)
pixaAddPix()
BOXA * boxaSaveValid(BOXA *boxas, l_int32 copyflag)
boxaSaveValid()
l_int32 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_int32 boxGetSideLocations(BOX *box, l_int32 *pl, l_int32 *pr, l_int32 *pt, l_int32 *pb)
boxGetSideLocations()
l_int32 boxGetGeometry(BOX *box, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph)
boxGetGeometry()
BOX * boxAdjustSides(BOX *boxd, BOX *boxs, l_int32 delleft, l_int32 delright, l_int32 deltop, l_int32 delbot)
boxAdjustSides()
l_int32 boxaCombineOverlapsInPair(BOXA *boxas1, BOXA *boxas2, BOXA **pboxad1, BOXA **pboxad2, PIXA *pixadb)
boxaCombineOverlapsInPair()
l_int32 boxaGetNearestByDirection(BOXA *boxa, l_int32 i, l_int32 dir, l_int32 dist_select, l_int32 range, l_int32 *pindex, l_int32 *pdist)
boxaGetNearestByDirection()
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_int32 boxaaJoin(BOXAA *baad, BOXAA *baas, l_int32 istart, l_int32 iend)
boxaaJoin()
l_int32 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()
void numaDestroy(NUMA **pna)
numaDestroy()
BOX * boxRelocateOneSide(BOX *boxd, BOX *boxs, l_int32 loc, l_int32 sideflag)
boxRelocateOneSide()
l_int32 ptaGetIPt(PTA *pta, l_int32 index, l_int32 *px, l_int32 *py)
ptaGetIPt()
BOXA * boxaAdjustSides(BOXA *boxas, l_int32 delleft, l_int32 delright, l_int32 deltop, l_int32 delbot)
boxaAdjustSides()
l_int32 boxIntersects(BOX *box1, BOX *box2, l_int32 *presult)
boxIntersects()
l_int32 numaReplaceNumber(NUMA *na, l_int32 index, l_float32 val)
numaReplaceNumber()
l_int32 boxaaAddBoxa(BOXAA *baa, BOXA *ba, l_int32 copyflag)
boxaaAddBoxa()
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()
BOXA * boxaCombineOverlaps(BOXA *boxas, PIXA *pixadb)
boxaCombineOverlaps()
BOX * boxCopy(BOX *box)
boxCopy()
l_int32 numaSetValue(NUMA *na, l_int32 index, l_float32 val)
numaSetValue()
void ptaDestroy(PTA **ppta)
ptaDestroy()
BOXA * boxaCreate(l_int32 n)
boxaCreate()
void boxDestroy(BOX **pbox)
boxDestroy()
l_int32 boxaGetExtent(BOXA *boxa, l_int32 *pw, l_int32 *ph, BOX **pbox)
boxaGetExtent()
l_int32 boxaGetCount(BOXA *boxa)
boxaGetCount()
l_int32 numaGetIValue(NUMA *na, l_int32 index, l_int32 *pival)
numaGetIValue()
l_int32 pixSetAll(PIX *pix)
pixSetAll()
BOX * boxCreate(l_int32 x, l_int32 y, l_int32 w, l_int32 h)
boxCreate()
l_int32 boxaFindNearestBoxes(BOXA *boxa, l_int32 dist_select, l_int32 range, NUMAA **pnaaindex, NUMAA **pnaadist)
boxaFindNearestBoxes()
l_int32 boxOverlapArea(BOX *box1, BOX *box2, l_int32 *parea)
boxOverlapArea()
l_int32 boxaReplaceBox(BOXA *boxa, l_int32 index, BOX *box)
boxaReplaceBox()
BOXA * boxaaGetBoxa(BOXAA *baa, l_int32 index, l_int32 accessflag)
boxaaGetBoxa()
l_int32 boxaSplitEvenOdd(BOXA *boxa, l_int32 fillflag, BOXA **pboxae, BOXA **pboxao)
boxaSplitEvenOdd()
l_int32 boxaContainedInBoxCount(BOXA *boxa, BOX *box, l_int32 *pcount)
boxaContainedInBoxCount()