RNotes | EBImage


library(EBImage)

Filters

filter2: 2D Convolution Filter

Filters an image using the fast 2D FFT convolution product.

x <- readImage(system.file("images", "sample-color.png", package="EBImage"))
display(x, title='Sample')

Low-pass disc-shaped filter

f <- makeBrush(21, shape='disc', step=FALSE)
display(f, title='Disc filter')

f <- f/sum(f)
y <- filter2(x, f)
display(y, title='Filtered image')

High-pass Laplacian filter

la <- matrix(1, nc=3, nr=3)
la[2,2] <- -8
la
##      [,1] [,2] [,3]
## [1,]    1    1    1
## [2,]    1   -8    1
## [3,]    1    1    1
y <- filter2(x, la)
display(y, title='Filtered image')

gblur: Low-pass Gaussian filter

Filters an image with a low-pass Gaussian filter.

x <- readImage(system.file("images", "sample.png", package="EBImage"))
display(x)

y <- gblur(x, sigma=8)
display(y, title='gblur(x, sigma=8)')

medianFilter: 2D constant time median filtering

Filters a 16-bit image using Perreault’s modern constant time median filtering algorithm.

Median filtering is useful as a smoothing technique, e.g. in the removal of speckling noise.

x <- readImage(system.file("images", "nuclei.tif", package="EBImage"))
display(x, title='Nuclei', all=TRUE)

y <- medianFilter(x, 5)  
display(y, title='Filtered nuclei', all=TRUE)


packageVersion("EBImage")
## [1] '4.8.2'

efg
2015-01-18 1939