Image-Leptonica
view release on metacpan or search on metacpan
lib/Image/Leptonica/Func/boxfunc1.pm view on Meta::CPAN
Return: 0 if OK, 1 on error
Notes:
(1) If the intersection is at only one point (a corner), the
coordinates are returned in (x1, y1).
(2) Represent a vertical line by one with a large but finite slope.
=head2 boxIntersects
l_int32 boxIntersects ( BOX *box1, BOX *box2, l_int32 *presult )
boxIntersects()
Input: box1, box2
&result (<return> 1 if any part of box2 is contained
in box1, and 0 otherwise)
Return: 0 if OK, 1 on error
=head2 boxOverlapArea
l_int32 boxOverlapArea ( BOX *box1, BOX *box2, l_int32 *parea )
boxOverlapArea()
Input: box1, box2 (two boxes)
&area (<return> the number of pixels in the overlap)
Return: 0 if OK, 1 on error.
=head2 boxOverlapFraction
l_int32 boxOverlapFraction ( BOX *box1, BOX *box2, l_float32 *pfract )
boxOverlapFraction()
Input: box1, box2 (two boxes)
&fract (<return> the fraction of box2 overlapped by box1)
Return: 0 if OK, 1 on error.
Notes:
(1) The result depends on the order of the input boxes,
because the overlap is taken as a fraction of box2.
=head2 boxOverlapRegion
BOX * boxOverlapRegion ( BOX *box1, BOX *box2 )
boxOverlapRegion()
Input: box1, box2 (two boxes)
Return: box (of overlap region between input boxes),
or null if no overlap or on error
=head2 boxRelocateOneSide
BOX * boxRelocateOneSide ( BOX *boxd, BOX *boxs, l_int32 loc, l_int32 sideflag )
boxRelocateOneSide()
Input: boxd (<optional>; this can be null, equal to boxs,
or different from boxs);
boxs (starting box; to have one side relocated)
loc (new location of the side that is changing)
sideflag (L_FROM_LEFT, etc., indicating the side that moves)
Return: boxd, or null on error or if the computed boxd has
width or height <= 0.
Notes:
(1) Set boxd == NULL to get new box; boxd == boxs for in-place;
or otherwise to resize existing boxd.
(2) For usage, suggest one of these:
boxd = boxRelocateOneSide(NULL, boxs, ...); // new
boxRelocateOneSide(boxs, boxs, ...); // in-place
boxRelocateOneSide(boxd, boxs, ...); // other
=head2 boxSeparationDistance
l_int32 boxSeparationDistance ( BOX *box1, BOX *box2, l_int32 *ph_sep, l_int32 *pv_sep )
boxSeparationDistance()
Input: box1, box2 (two boxes, in any order)
&h_sep (<optional return> horizontal separation)
&v_sep (<optional return> vertical separation)
Return: 0 if OK, 1 on error
Notes:
(1) This measures horizontal and vertical separation of the
two boxes. If the boxes are touching but have no pixels
in common, the separation is 0. If the boxes overlap by
a distance d, the returned separation is -d.
=head2 boxSimilar
l_int32 boxSimilar ( BOX *box1, BOX *box2, l_int32 leftdiff, l_int32 rightdiff, l_int32 topdiff, l_int32 botdiff, l_int32 *psimilar )
boxSimilar()
Input: box1
box2
leftdiff, rightdiff, topdiff, botdiff
&similar (<return> 1 if similar; 0 otherwise)
Return 0 if OK, 1 on error
Notes:
(1) The values of leftdiff (etc) are the maximum allowed deviations
between the locations of the left (etc) sides. If any side
pairs differ by more than this amount, the boxes are not similar.
=head2 boxaAdjustHeightToTarget
BOXA * boxaAdjustHeightToTarget ( BOXA *boxad, BOXA *boxas, l_int32 sides, l_int32 target, l_int32 thresh )
boxaAdjustHeightToTarget()
Input: boxad (use null to get a new one)
boxas
sides (L_ADJUST_TOP, L_ADJUST_BOT, L_ADJUST_TOP_AND_BOT)
target (target height if differs by more than thresh)
thresh (min abs difference in height to cause adjustment)
Return: boxad, or null on error
( run in 0.986 second using v1.01-cache-2.11-cpan-71847e10f99 )