erode {imager}R Documentation

Erode/dilate image by a structuring element.

Description

Erode/dilate image by a structuring element.

Usage

erode(im, mask, boundary_conditions = TRUE, real_mode = FALSE)

erode_rect(im, sx, sy, sz = 1L)

erode_square(im, size)

dilate(im, mask, boundary_conditions = TRUE, real_mode = FALSE)

dilate_rect(im, sx, sy, sz = 1L)

dilate_square(im, size)

mopening(im, mask, boundary_conditions = TRUE, real_mode = FALSE)

mopening_square(im, size)

mclosing_square(im, size)

mclosing(im, mask, boundary_conditions = TRUE, real_mode = FALSE)

Arguments

im

an image

mask

Structuring element.

boundary_conditions

Boundary conditions. If FALSE, pixels beyond image boundaries are considered to be 0, if TRUE one. Default: TRUE.

real_mode

If TRUE, perform erosion as defined on the reals. If FALSE, perform binary erosion (default FALSE).

sx

Width of the structuring element.

sy

Height of the structuring element.

sz

Depth of the structuring element.

size

size of the structuring element.

Functions

Examples


fname <- system.file('extdata/Leonardo_Birds.jpg',package='imager')
im <- load.image(fname) %>% grayscale
outline <- threshold(-im,"95%")
plot(outline)
mask <- imfill(5,10,val=1) #Rectangular mask
plot(erode(outline,mask))
plot(erode_rect(outline,5,10)) #Same thing
plot(erode_square(outline,5)) 
plot(dilate(outline,mask))
plot(dilate_rect(outline,5,10))
plot(dilate_square(outline,5)) 

[Package imager version 1.0.2 Index]