Leptonica
1.54
|
#include "allheaders.h"
Функции | |
PIX * | pixRankFilter (PIX *pixs, l_int32 wf, l_int32 hf, l_float32 rank) |
PIX * | pixRankFilterRGB (PIX *pixs, l_int32 wf, l_int32 hf, l_float32 rank) |
PIX * | pixRankFilterGray (PIX *pixs, l_int32 wf, l_int32 hf, l_float32 rank) |
PIX * | pixMedianFilter (PIX *pixs, l_int32 wf, l_int32 hf) |
PIX * | pixRankFilterWithScaling (PIX *pixs, l_int32 wf, l_int32 hf, l_float32 rank, l_float32 scalefactor) |
PIX* pixMedianFilter | ( | PIX * | pixs, |
l_int32 | wf, | ||
l_int32 | hf | ||
) |
Input: pixs (8 or 32 bpp; no colormap) wf, hf (width and height of filter; each is >= 1) Return: pixd (of median values), or null on error
Input: pixs (8 or 32 bpp; no colormap) wf, hf (width and height of filter; each is >= 1) rank (in [0.0 ... 1.0]) Return: pixd (of rank values), or null on error
Notes: (1) This defines, for each pixel in pixs, a neighborhood of pixels given by a rectangle "centered" on the pixel. This set of wf*hf pixels has a distribution of values. For each component, if the values are sorted in increasing order, we choose the component such that rank*(wf*hf-1) pixels have a lower or equal value and (1-rank)*(wf*hf-1) pixels have an equal or greater value. (2) See notes in pixRankFilterGray() for further details.
Input: pixs (8 bpp; no colormap) wf, hf (width and height of filter; each is >= 1) rank (in [0.0 ... 1.0]) Return: pixd (of rank values), or null on error
Notes: (1) This defines, for each pixel in pixs, a neighborhood of pixels given by a rectangle "centered" on the pixel. This set of wf*hf pixels has a distribution of values, and if they are sorted in increasing order, we choose the pixel such that rank*(wf*hf-1) pixels have a lower or equal value and (1-rank)*(wf*hf-1) pixels have an equal or greater value. (2) By this definition, the rank = 0.0 pixel has the lowest value, and the rank = 1.0 pixel has the highest value. (3) We add mirrored boundary pixels to avoid boundary effects, and put the filter center at (0, 0). (4) This dispatches to grayscale erosion or dilation if the filter dimensions are odd and the rank is 0.0 or 1.0, rsp. (5) Returns a copy if both wf and hf are 1. (6) Uses row-major or column-major incremental updates to the histograms depending on whether hf > wf or hv <= wf, rsp.
Input: pixs (32 bpp) wf, hf (width and height of filter; each is >= 1) rank (in [0.0 ... 1.0]) Return: pixd (of rank values), or null on error
Notes: (1) This defines, for each pixel in pixs, a neighborhood of pixels given by a rectangle "centered" on the pixel. This set of wf*hf pixels has a distribution of values. For each component, if the values are sorted in increasing order, we choose the component such that rank*(wf*hf-1) pixels have a lower or equal value and (1-rank)*(wf*hf-1) pixels have an equal or greater value. (2) Apply gray rank filtering to each component independently. (3) See notes in pixRankFilterGray() for further details.
PIX* pixRankFilterWithScaling | ( | PIX * | pixs, |
l_int32 | wf, | ||
l_int32 | hf, | ||
l_float32 | rank, | ||
l_float32 | scalefactor | ||
) |
Input: pixs (8 or 32 bpp; no colormap) wf, hf (width and height of filter; each is >= 1) rank (in [0.0 ... 1.0]) scalefactor (scale factor; must be >= 0.2 and <= 0.7) Return: pixd (of rank values), or null on error
Notes: (1) This is a convenience function that downscales, does the rank filtering, and upscales. Because the down- and up-scaling functions are very fast compared to rank filtering, the time it takes is reduced from that for the simple rank filtering operation by approximately the square of the scaling factor.