erode: Erode/dilate image by a structuring element.

Description Usage Arguments Functions Examples

Description

Erode/dilate image by a structuring element.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
erode(im, mask, boundary_conditions = TRUE, normalise = FALSE)

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

erode_square(im, size)

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

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

dilate_square(im, size)

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

mopening_square(im, size)

mclosing_square(im, size)

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

Arguments

im

an image

mask

Structuring element.

boundary_conditions

Boundary conditions.

normalise

Determines if the closing is locally normalised (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

  • erode_rect: Erode image by a rectangular structuring element of specified size.

  • erode_square: Erode image by a square structuring element of specified size.

  • dilate: Dilate image by a structuring element.

  • dilate_rect: Dilate image by a rectangular structuring element of specified size

  • dilate_square: Dilate image by a square structuring element of specified size

  • mopening: Morphological opening (erosion followed by dilation)

  • mopening_square: Morphological opening by a square element (erosion followed by dilation)

  • mclosing_square: Morphological closing by a square element (dilation followed by erosion)

  • mclosing: Morphological closing (dilation followed by erosion)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)) 


Search within the imager package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.