![]() |
Leptonica
1.82.0
Image processing and image analysis suite
|
#include <math.h>
#include "allheaders.h"
Go to the source code of this file.
Functions | |
static l_int32 | boxaFillAll (BOXA *boxa) |
static void | adjustSidePlotName (char *buf, size_t size, const char *preface, l_int32 select) |
BOXA * | boxaSmoothSequenceMedian (BOXA *boxas, l_int32 halfwin, l_int32 subflag, l_int32 maxdiff, l_int32 extrapixels, l_int32 debug) |
BOXA * | boxaWindowedMedian (BOXA *boxas, l_int32 halfwin, l_int32 debug) |
BOXA * | boxaModifyWithBoxa (BOXA *boxas, BOXA *boxam, l_int32 subflag, l_int32 maxdiff, l_int32 extrapixels) |
BOXA * | boxaReconcilePairWidth (BOXA *boxas, l_int32 delw, l_int32 op, l_float32 factor, NUMA *na) |
l_ok | boxaSizeConsistency (BOXA *boxas, l_int32 type, l_float32 threshp, l_float32 threshm, l_float32 *pfvarp, l_float32 *pfvarm, l_int32 *psame) |
BOXA * | boxaReconcileAllByMedian (BOXA *boxas, l_int32 select1, l_int32 select2, l_int32 thresh, l_int32 extra, PIXA *pixadb) |
BOXA * | boxaReconcileSidesByMedian (BOXA *boxas, l_int32 select, l_int32 thresh, l_int32 extra, PIXA *pixadb) |
BOXA * | boxaReconcileSizeByMedian (BOXA *boxas, l_int32 type, l_float32 dfract, l_float32 sfract, l_float32 factor, NUMA **pnadelw, NUMA **pnadelh, l_float32 *pratiowh) |
l_ok | boxaPlotSides (BOXA *boxa, const char *plotname, NUMA **pnal, NUMA **pnat, NUMA **pnar, NUMA **pnab, PIX **ppixd) |
l_ok | boxaPlotSizes (BOXA *boxa, const char *plotname, NUMA **pnaw, NUMA **pnah, PIX **ppixd) |
BOXA * | boxaFillSequence (BOXA *boxas, l_int32 useflag, l_int32 debug) |
l_ok | boxaSizeVariation (BOXA *boxa, l_int32 type, l_float32 *pdel_evenodd, l_float32 *prms_even, l_float32 *prms_odd, l_float32 *prms_all) |
l_ok | boxaMedianDimensions (BOXA *boxas, l_int32 *pmedw, l_int32 *pmedh, l_int32 *pmedwe, l_int32 *pmedwo, l_int32 *pmedhe, l_int32 *pmedho, NUMA **pnadelw, NUMA **pnadelh) |
Boxa sequence fitting BOXA *boxaSmoothSequenceMedian() BOXA *boxaWindowedMedian() BOXA *boxaModifyWithBoxa() BOXA *boxaReconcilePairWidth() l_int32 boxaSizeConsistency() BOXA *boxaReconcileAllByMedian() BOXA *boxaReconcileSidesByMedian() static void adjustSidePlotName() -- debug BOXA *boxaReconcileSizeByMedian() l_int32 boxaPlotSides() [for debugging] l_int32 boxaPlotSizes() [for debugging] BOXA *boxaFillSequence() static l_int32 boxaFillAll() l_int32 boxaSizeVariation() l_int32 boxaMedianDimensions()
Definition in file boxfunc5.c.
|
static |
[in] | boxa |
Notes: (1) This static function replaces every invalid box with the nearest valid box. If there are no valid boxes, it issues a warning.
Definition at line 1527 of file boxfunc5.c.
References boxaGetBox(), boxaGetCount(), boxaGetValidBox(), boxaGetValidCount(), boxaReplaceBox(), boxDestroy(), L_CLONE, and L_COPY.
Referenced by boxaFillSequence().
[in] | boxas | with at least 3 boxes |
[in] | useflag | L_USE_ALL_BOXES, L_USE_SAME_PARITY_BOXES |
[in] | debug | 1 for debug output |
Notes: (1) This simple function replaces invalid boxes with a copy of the nearest valid box, selected from either the entire sequence (L_USE_ALL_BOXES) or from the boxes with the same parity (L_USE_SAME_PARITY_BOXES). It returns a new boxa. (2) This is useful if you expect boxes in the sequence to vary slowly with index.
Definition at line 1468 of file boxfunc5.c.
References boxaCopy(), boxaDestroy(), boxaFillAll(), boxaGetCount(), boxaGetValidCount(), boxaMergeEvenOdd(), boxaSplitEvenOdd(), L_COPY, L_USE_ALL_BOXES, and L_USE_SAME_PARITY_BOXES.
Referenced by boxaPlotSides(), boxaPlotSizes(), and boxaWindowedMedian().
l_ok boxaMedianDimensions | ( | BOXA * | boxas, |
l_int32 * | pmedw, | ||
l_int32 * | pmedh, | ||
l_int32 * | pmedwe, | ||
l_int32 * | pmedwo, | ||
l_int32 * | pmedhe, | ||
l_int32 * | pmedho, | ||
NUMA ** | pnadelw, | ||
NUMA ** | pnadelh | ||
) |
[in] | boxas | containing at least 3 valid boxes in even and odd |
[out] | pmedw | [optional] median width of all boxes |
[out] | pmedh | [optional] median height of all boxes |
[out] | pmedwe | [optional] median width of even boxes |
[out] | pmedwo | [optional] median width of odd boxes |
[out] | pmedhe | [optional] median height of even boxes |
[out] | pmedho | [optional] median height of odd boxes |
[out] | pnadelw | [optional] width diff of each box from median |
[out] | pnadelh | [optional] height diff of each box from median |
Notes: (1) This provides information that (1) allows identification of boxes that have unusual (outlier) width or height, and (2) can be used to regularize the sizes of the outlier boxes, assuming that the boxes satisfy a fairly regular sequence and should mostly have the same width and height. (2) This finds the median width and height, as well as separate median widths and heights of even and odd boxes. It also generates arrays that give the difference in width and height of each box from the median, which can be used to correct individual boxes. (3) All return values are optional.
Definition at line 1714 of file boxfunc5.c.
References boxaDestroy(), boxaGetBoxGeometry(), boxaGetCount(), boxaGetMedianVals(), boxaGetValidCount(), boxaSplitEvenOdd(), numaAddNumber(), numaCreate(), and numaDestroy().
Referenced by boxaReconcileSizeByMedian().
BOXA* boxaModifyWithBoxa | ( | BOXA * | boxas, |
BOXA * | boxam, | ||
l_int32 | subflag, | ||
l_int32 | maxdiff, | ||
l_int32 | extrapixels | ||
) |
[in] | boxas | |
[in] | boxam | boxa with boxes used to modify those in boxas |
[in] | subflag | L_USE_MINSIZE, L_USE_MAXSIZE, L_SUB_ON_LOC_DIFF, L_SUB_ON_SIZE_DIFF, L_USE_CAPPED_MIN, L_USE_CAPPED_MAX |
[in] | maxdiff | parameter used with L_SUB_ON_LOC_DIFF, L_SUB_ON_SIZE_DIFF, L_USE_CAPPED_MIN, L_USE_CAPPED_MAX |
[in] | extrapixels | pixels added on all sides (or subtracted if extrapixels < 0) when using L_SUB_ON_LOC_DIFF and L_SUB_ON_SIZE_DIFF |
Notes: (1) This takes two input boxa (boxas, boxam) and constructs boxad, where each box in boxad is generated from the corresponding boxes in boxas and boxam. The rule for constructing each output box depends on subflag and maxdiff. Let boxs be a box from boxas and boxm be a box from boxam. * If subflag == L_USE_MINSIZE: the output box is the intersection of the two input boxes. * If subflag == L_USE_MAXSIZE: the output box is the union of the two input boxes; i.e., the minimum bounding rectangle for the two input boxes. * If subflag == L_SUB_ON_LOC_DIFF: each side of the output box is found separately from the corresponding side of boxs and boxm. Use the boxm side, expanded by extrapixels, if greater than maxdiff pixels from the boxs side. * If subflag == L_SUB_ON_SIZE_DIFF: the sides of the output box are determined in pairs from the width and height of boxs and boxm. If the boxm width differs by more than maxdiff pixels from boxs, use the boxm left and right sides, expanded by extrapixels. Ditto for the height difference. For the last two flags, each side of the output box is found separately from the corresponding side of boxs and boxm, according to these rules, where "smaller"("bigger") mean in a direction that decreases(increases) the size of the output box: * If subflag == L_USE_CAPPED_MIN: use the Min of boxm with the Max of (boxs, boxm +- maxdiff), where the sign is adjusted to make the box smaller (e.g., use "+" on left side). * If subflag == L_USE_CAPPED_MAX: use the Max of boxm with the Min of (boxs, boxm +- maxdiff), where the sign is adjusted to make the box bigger (e.g., use "-" on left side). Use of the last 2 flags is further explained in (3) and (4). (2) boxas and boxam must be the same size. If boxam == NULL, this returns a copy of boxas with a warning. (3) If subflag == L_SUB_ON_LOC_DIFF, use boxm for each side where the corresponding sides differ by more than maxdiff. Two extreme cases: (a) set maxdiff == 0 to use only values from boxam in boxad. (b) set maxdiff == 10000 to ignore all values from boxam; then boxad will be the same as boxas. (4) If subflag == L_USE_CAPPED_MAX: use boxm if boxs is smaller; use boxs if boxs is bigger than boxm by an amount up to maxdiff; and use boxm +- maxdiff (the 'capped' value) if boxs is bigger than boxm by an amount larger than maxdiff. Similarly, with interchange of Min/Max and sign of maxdiff, for subflag == L_USE_CAPPED_MIN. (5) If either of corresponding boxes in boxas and boxam is invalid, an invalid box is copied to the result. (6) Typical input for boxam may be the output of boxaLinearFit(). where outliers have been removed and each side is LS fit to a line. (7) Unlike boxaAdjustWidthToTarget() and boxaAdjustHeightToTarget(), this uses two boxes and does not specify target dimensions.
Definition at line 351 of file boxfunc5.c.
References boxaAddBox(), boxaCopy(), boxaCreate(), boxaGetCount(), boxaGetValidBox(), boxCreate(), boxDestroy(), boxGetGeometry(), L_CLONE, L_COPY, L_INSERT, L_SUB_ON_LOC_DIFF, L_SUB_ON_SIZE_DIFF, L_USE_CAPPED_MAX, L_USE_CAPPED_MIN, L_USE_MAXSIZE, and L_USE_MINSIZE.
Referenced by boxaSmoothSequenceMedian().
l_ok boxaPlotSides | ( | BOXA * | boxa, |
const char * | plotname, | ||
NUMA ** | pnal, | ||
NUMA ** | pnat, | ||
NUMA ** | pnar, | ||
NUMA ** | pnab, | ||
PIX ** | ppixd | ||
) |
[in] | boxa | source boxa |
[in] | plotname | [optional], can be NULL |
[out] | pnal | [optional] na of left sides |
[out] | pnat | [optional] na of top sides |
[out] | pnar | [optional] na of right sides |
[out] | pnab | [optional] na of bottom sides |
[out] | ppixd | pix of the output plot |
Notes: (1) This debugging function shows the progression of the four sides in the boxa. There must be at least 2 boxes. (2) If there are invalid boxes (e.g., if only even or odd indices have valid boxes), this will fill them with the nearest valid box before plotting. (3) The plotfiles are put in /tmp/lept/plots/, and are named either with plotname or, if NULL, a default name. If plotname is used, make sure it has no whitespace characters.
Definition at line 1251 of file boxfunc5.c.
References boxaDestroy(), boxaFillSequence(), boxaGetBoxGeometry(), boxaGetCount(), gplotCreate(), L_USE_ALL_BOXES, lept_mkdir(), numaAddNumber(), and numaCreate().
Referenced by boxaSmoothSequenceMedian(), and boxaWindowedMedian().
[in] | boxa | source boxa |
[in] | plotname | [optional], can be NULL |
[out] | pnaw | [optional] na of widths |
[out] | pnah | [optional] na of heights |
[out] | ppixd | pix of the output plot |
Notes: (1) This debugging function shows the progression of box width and height in the boxa. There must be at least 2 boxes. (2) If there are invalid boxes (e.g., if only even or odd indices have valid boxes), this will fill them with the nearest valid box before plotting. (3) The plotfiles are put in /tmp/lept/plots/, and are named either with plotname or, if NULL, a default name. If plotname is used, make sure it has no whitespace characters.
Definition at line 1384 of file boxfunc5.c.
References boxaDestroy(), boxaFillSequence(), boxaGetBoxGeometry(), boxaGetCount(), gplotCreate(), L_USE_ALL_BOXES, lept_mkdir(), numaAddNumber(), and numaCreate().
BOXA* boxaReconcileAllByMedian | ( | BOXA * | boxas, |
l_int32 | select1, | ||
l_int32 | select2, | ||
l_int32 | thresh, | ||
l_int32 | extra, | ||
PIXA * | pixadb | ||
) |
[in] | boxas | containing at least 6 valid boxes |
[in] | select1 | L_ADJUST_LEFT_AND_RIGHT or L_ADJUST_SKIP |
[in] | select2 | L_ADJUST_TOP_AND_BOT or L_ADJUST_SKIP |
[in] | thresh | threshold number of pixels to make adjustment |
[in] | extra | extra pixels to add beyond median value |
[in] | pixadb | use NULL to skip debug output |
Notes: (1) This uses boxaReconcileSidesByMedian() to reconcile the left-and-right and/or top-and-bottom sides of the even and odd boxes, separately. (2) See boxaReconcileSidesByMedian() for use of thresh and extra. (3) If all box sides are within thresh of the median value, the returned box will be identical to boxas.
Definition at line 691 of file boxfunc5.c.
References boxaCopy(), boxaGetValidCount(), boxaMergeEvenOdd(), boxaReconcileSidesByMedian(), boxaSplitEvenOdd(), L_ADJUST_LEFT_AND_RIGHT, L_ADJUST_SKIP, L_ADJUST_TOP_AND_BOT, L_COPY, lept_mkdir(), and pixaDisplayTiledInColumns().
BOXA* boxaReconcilePairWidth | ( | BOXA * | boxas, |
l_int32 | delw, | ||
l_int32 | op, | ||
l_float32 | factor, | ||
NUMA * | na | ||
) |
[in] | boxas | |
[in] | delw | threshold on adjacent width difference |
[in] | op | L_ADJUST_CHOOSE_MIN, L_ADJUST_CHOOSE_MAX |
[in] | factor | > 0.0, typically near 1.0 |
[in] | na | [optional] indicator array allowing change |
Notes: (1) This reconciles differences in the width of adjacent boxes, by moving one side of one of the boxes in each pair. If the widths in the pair differ by more than some threshold, move either the left side for even boxes or the right side for odd boxes, depending on if we're choosing the min or max. If choosing min, the width of the max is set to factor * (width of min). If choosing max, the width of the min is set to factor * (width of max). (2) If na exists, it is an indicator array corresponding to the boxes in boxas. If na != NULL, only boxes with an indicator value of 1 are allowed to adjust; otherwise, all boxes can adjust. (3) Typical input might be the output of boxaSmoothSequenceMedian(), where even and odd boxa have been independently regulated.
Definition at line 467 of file boxfunc5.c.
References boxaDestroy(), boxaGetBox(), boxaGetCount(), boxaMergeEvenOdd(), boxaSplitEvenOdd(), boxDestroy(), boxGetGeometry(), boxSetGeometry(), L_ADJUST_CHOOSE_MIN, L_CLONE, and numaGetIValue().
BOXA* boxaReconcileSidesByMedian | ( | BOXA * | boxas, |
l_int32 | select, | ||
l_int32 | thresh, | ||
l_int32 | extra, | ||
PIXA * | pixadb | ||
) |
[in] | boxas | containing at least 3 valid boxes |
[in] | select | L_ADJUST_LEFT, L_ADJUST_RIGHT, etc. |
[in] | thresh | threshold number of pixels to make adjustment |
[in] | extra | extra pixels to add beyond median value |
[in] | pixadb | use NULL to skip debug output |
Notes: (1) This modifies individual box sides if their location differs significantly (>= thresh) from the median value. (2) select specifies which sides are to be checked. (3) thresh specifies the tolerance for different side locations. Any box side that differs from the median by this much will be set to the median value, plus the extra amount. (4) If extra is positive, the box dimensions are expanded. For example, for the left side, a positive extra results in moving the left side farther to the left (i.e., in a negative direction). (5) If all box sides are within thresh - 1 of the median value, the returned box will be identical to boxas. (6) N.B. If you expect that even and odd box sides should be significantly different, this function must be called separately on the even and odd boxes in boxas. Note also that the higher level function boxaReconcileAllByMedian() handles the even and odd box sides separately.
Definition at line 804 of file boxfunc5.c.
References boxaCopy(), boxaDestroy(), boxaGetValidCount(), L_ADJUST_BOT, L_ADJUST_LEFT, L_ADJUST_LEFT_AND_RIGHT, L_ADJUST_RIGHT, L_ADJUST_TOP, L_ADJUST_TOP_AND_BOT, L_COPY, and pixaGetCount().
Referenced by boxaReconcileAllByMedian().
BOXA* boxaReconcileSizeByMedian | ( | BOXA * | boxas, |
l_int32 | type, | ||
l_float32 | dfract, | ||
l_float32 | sfract, | ||
l_float32 | factor, | ||
NUMA ** | pnadelw, | ||
NUMA ** | pnadelh, | ||
l_float32 * | pratiowh | ||
) |
[in] | boxas | containing at least 6 valid boxes |
[in] | type | L_CHECK_WIDTH, L_CHECK_HEIGHT, L_CHECK_BOTH |
[in] | dfract | threshold fraction of dimensional variation from median; in range (0 ... 1); typ. about 0.05. |
[in] | sfract | threshold fraction of side variation from median; in range (0 ... 1); typ. about 0.04. |
[in] | factor | expansion for fixed box beyond median width; should be near 1.0. |
[out] | pnadelw | [optional] diff from median width for boxes above threshold |
[out] | pnadelh | [optional] diff from median height for boxes above threshold |
[out] | pratiowh | [optional] ratio of median width/height of boxas |
Notes: (1) The basic idea is to identify significant differences in box dimension (either width or height) and modify the outlier boxes. (2) type specifies if we are reconciling the width, height or both. (3) dfract specifies the tolerance for different dimensions. Any box with a fractional difference from the median size that exceeds dfract will be altered. (4) sfract specifies the tolerance for different side locations. If a box has been marked by (3) for alteration, any side location that differs from the median side location by more than sfract of the median dimension (medw or medh) will be moved. (5) Median width and height are found for all valid boxes (i.e., for all boxes with width and height > 0. Median side locations are found separately for even and odd boxes, using only boxes that are "inliers"; i.e., that have been found by (3) to be within tolerance for width or height. (6) If all box dimensions are within threshold of the median size, just return a copy. Otherwise, box sides of the outliers will be adjusted. (7) Using sfract, sides that are sufficiently far from the median are first moved to the median value. Then they are moved together (in or out) so that the final box dimension is factor times the median dimension. (8) The arrays that are the initial deviation from median size (width and height) are optionally returned. Also optionally returned is the median w/h asperity ratio of the input boxas.
Definition at line 982 of file boxfunc5.c.
References boxaAddBox(), boxaCopy(), boxaCreate(), boxaDestroy(), boxaGetBox(), boxaGetCount(), boxaGetMedianVals(), boxaGetValidBox(), boxaGetValidCount(), boxaMedianDimensions(), boxDestroy(), boxGetGeometry(), boxGetSideLocations(), boxIsValid(), boxSetSide(), L_CHECK_BOTH, L_CHECK_HEIGHT, L_CHECK_WIDTH, L_COPY, L_INSERT, L_SET_BOT, L_SET_LEFT, L_SET_RIGHT, L_SET_TOP, numaAddNumber(), numaCreate(), numaDestroy(), and numaGetIValue().
l_ok boxaSizeConsistency | ( | BOXA * | boxas, |
l_int32 | type, | ||
l_float32 | threshp, | ||
l_float32 | threshm, | ||
l_float32 * | pfvarp, | ||
l_float32 * | pfvarm, | ||
l_int32 * | psame | ||
) |
[in] | boxas | of size >= 10 |
[in] | type | L_CHECK_WIDTH, L_CHECK_HEIGHT |
[in] | threshp | threshold for pairwise fractional variation |
[in] | threshm | threshold for fractional variation from median |
[out] | pfvarp | [optional] average fractional pairwise variation |
[out] | pfvarm | [optional] average fractional median variation |
[out] | psame | decision for uniformity of page size (1, 0, -1) |
Notes: (1) This evaluates a boxa for particular types of dimensional variation. Select either width or height variation. Then it returns two numbers: one is based on pairwise (even/odd) variation; the other is based on the average variation from the boxa median. (2) For the pairwise variation, get the fraction of the absolute difference in dimension of each pair of boxes, and take the average value. The median variation is simply the the average of the fractional deviation from the median of all the boxes. (3) Use 0 for default values of threshp and threshm. They are threshp: 0.02 threshm: 0.015 (4) The intended application is that the boxes are a sequence of page regions in a book scan, and we calculate two numbers that can give an indication if the pages are approximately the same size. The pairwise variation should be small if the boxes are correctly calculated. If there are a significant number of random or systematic outliers, the pairwise variation will be large, and no decision will be made (i.e., return same == -1). Here are the possible outcomes: Pairwise Var Median Var Decision ------------ ---------- -------- small small same size (1) small large different size (0) large small/large unknown (-1)
Definition at line 590 of file boxfunc5.c.
References boxaGetBoxGeometry(), boxaGetCount(), boxaGetValidCount(), L_CHECK_HEIGHT, L_CHECK_WIDTH, numaAddNumber(), numaCreate(), numaDestroy(), numaGetMeanDevFromMedian(), and numaGetMedian().
l_ok boxaSizeVariation | ( | BOXA * | boxa, |
l_int32 | type, | ||
l_float32 * | pdel_evenodd, | ||
l_float32 * | prms_even, | ||
l_float32 * | prms_odd, | ||
l_float32 * | prms_all | ||
) |
[in] | boxa | at least 4 boxes |
[in] | type | L_SELECT_WIDTH, L_SELECT_HEIGHT |
[out] | pdel_evenodd | [optional] average absolute value of (even - odd) size pairs |
[out] | prms_even | [optional] rms deviation of even boxes |
[out] | prms_odd | [optional] rms deviation of odd boxes |
[out] | prms_all | [optional] rms deviation of all boxes |
Notes: (1) This gives several measures of the smoothness of either the width or height of a sequence of boxes. See boxaMedianDimensions() for some other measures. (2) Statistics can be found separately for even and odd boxes. Additionally, the average pair-wise difference between adjacent even and odd boxes can be returned. (3) The use case is bounding boxes for scanned page images, where ideally the sizes should have little variance.
Definition at line 1611 of file boxfunc5.c.
References boxaDestroy(), boxaGetCount(), boxaGetSizes(), boxaSplitEvenOdd(), L_SELECT_HEIGHT, L_SELECT_WIDTH, numaDestroy(), numaGetIValue(), and numaSimpleStats().
BOXA* boxaSmoothSequenceMedian | ( | BOXA * | boxas, |
l_int32 | halfwin, | ||
l_int32 | subflag, | ||
l_int32 | maxdiff, | ||
l_int32 | extrapixels, | ||
l_int32 | debug | ||
) |
[in] | boxas | source boxa |
[in] | halfwin | half-width of sliding window; used to find median |
[in] | subflag | L_USE_MINSIZE, L_USE_MAXSIZE, L_SUB_ON_LOC_DIFF, L_SUB_ON_SIZE_DIFF, L_USE_CAPPED_MIN, L_USE_CAPPED_MAX |
[in] | maxdiff | parameter used with L_SUB_ON_LOC_DIFF, L_SUB_ON_SIZE_DIFF, L_USE_CAPPED_MIN, L_USE_CAPPED_MAX |
[in] | extrapixels | pixels added on all sides (or subtracted if extrapixels < 0) when using L_SUB_ON_LOC_DIFF and L_SUB_ON_SIZE_DIFF |
[in] | debug | 1 for debug output |
Notes: (1) The target width of the sliding window is 2 * halfwin + 1. If necessary, this will be reduced by boxaWindowedMedian(). (2) This returns a modified version of boxas by constructing for each input box a box that has been smoothed with windowed median filtering. The filtering is done to each of the box sides independently, and it is computed separately for sequences of even and odd boxes. The output boxad is constructed from the input boxa and the filtered boxa, depending on subflag. See boxaModifyWithBoxa() for details on the use of subflag, maxdiff and extrapixels. (3) This is useful for removing noise separately in the even and odd sets, where the box edge locations can have discontinuities but otherwise vary roughly linearly within intervals of size halfwin or larger. (4) If you don't need to handle even and odd sets separately, just do this: boxam = boxaWindowedMedian(boxas, halfwin, debug); boxad = boxaModifyWithBoxa(boxas, boxam, subflag, maxdiff, extrapixels); boxaDestroy(&boxam);
Definition at line 106 of file boxfunc5.c.
References boxaCopy(), boxaGetCount(), boxaMergeEvenOdd(), boxaModifyWithBoxa(), boxaPlotSides(), boxaSplitEvenOdd(), boxaWindowedMedian(), boxaWriteDebug(), L_COPY, L_SUB_ON_LOC_DIFF, L_SUB_ON_SIZE_DIFF, L_USE_CAPPED_MAX, L_USE_CAPPED_MIN, L_USE_MAXSIZE, L_USE_MINSIZE, and lept_mkdir().
[in] | boxas | source boxa |
[in] | halfwin | half width of window over which the median is found |
[in] | debug | 1 for debug output |
Notes: (1) This finds a set of boxes (boxad) where each edge of each box is a windowed median smoothed value to the edges of the input set of boxes (boxas). (2) Invalid input boxes are filled from nearby ones. (3) The returned boxad can then be used in boxaModifyWithBoxa() to selectively change the boxes in the source boxa.
Definition at line 206 of file boxfunc5.c.
References boxaAddBox(), boxaCopy(), boxaCreate(), boxaExtractAsNuma(), boxaFillSequence(), boxaGetCount(), boxaPlotSides(), boxCreate(), L_COPY, L_INSERT, L_USE_ALL_BOXES, lept_mkdir(), numaGetIValue(), and numaWindowedMedian().
Referenced by boxaSmoothSequenceMedian().