morphology {EBImage} | R Documentation |
Functions to perform morphological operations on binary images.
dilate(x, kern) erode(x, kern) opening(x, kern) closing(x, kern) makeBrush(size, shape=c('box', 'disc', 'diamond', 'gaussian'), step=TRUE, sigma=0.3)
x |
An |
kern |
An |
size |
A numeric containing the size of the brush, in pixels. |
shape |
A character vector indicating the shape of the brush. Can
be |
step |
a logical indicating if the brush is binary. Default is
|
sigma |
An optional numeric containing the standard deviation of the Gaussian shape. Default is 0.3. |
dilate
applies the mask positioning its centre over every background pixel
(0), every pixel which is not covered by the mask is reset to foreground (1).
erode
applies the mask positioning its centre over every foreground pixel
(!=0), every pixel which is not covered by the mask is reset to background (0).
opening
is an erosion followed by a dilation and closing
is a dilation
followed by an erosion.
makeBrush
generates brushes of various sizes and shapes that can be used
as structuring elements.
dilate
, erode
, opening
and closing
return the
transformed Image
object or array, after the corresponding
morphological operation.
makeBrush
generates a 2D matrix containing the desired brush.
Oleg Sklyar, osklyar@ebi.ac.uk, 2006
x = readImage(system.file("images", "shapes.png", package="EBImage")) if (interactive()) display(x) kern = makeBrush(5, shape='diamond') if (interactive()) display(kern, title='Structuring element') if (interactive()) display(erode(x, kern), title='Erosion of x') if (interactive()) display(dilate(x, kern), title='Dilatation of x') ## makeBrush x = makeBrush(100, shape='diamond') if (interactive()) display(x, title="makeBrush(100, shape='diamond')") x = makeBrush(100, shape='disc', step=FALSE) if (interactive()) display(x, title="makeBrush(100, shape='disc', step=FALSE)") x = makeBrush(100, shape='gaussian', sigma=10) if (interactive()) display(2000*x, title="makeBrush(100, shape='gaussian', sigma=10)")