median_filter {nandb} | R Documentation |
Smooth and median filters with options for handling NAs.
Description
These are alternatives to
EBImage::filter2()
and EBImage::medianFilter()
for
smooth and median filtering respectively. These functions have many options
for dealing with NA
values which EBImage
's functions lack.
Usage
median_filter(mat, size = 1L, na_rm = FALSE, na_count = FALSE)
smooth_filter(mat, size = 1L, na_rm = FALSE, na_count = FALSE)
Arguments
mat |
A matrix (representing an image). |
size |
An integer; the median filter radius. |
na_rm |
Should |
na_count |
If this is TRUE, in each median calculation, if the majority
of arguments are |
Details
The behavior at image boundaries is such as the source image has been padded with pixels whose values equal the nearest border pixel value.
Value
A matrix (the median filtered image).
Examples
m <- matrix(1:9, nrow = 3)
m[2:3, 2:3] <- NA
print(m)
median_filter(m)
median_filter(m, na_rm = TRUE)
median_filter(m, na_count = TRUE)
smooth_filter(m)
smooth_filter(m, na_rm = TRUE)
smooth_filter(m, na_count = TRUE)
[Package nandb version 2.1.0 Index]