morphology: Morphology: Erosion or Dilatation of Features on a Raster Map

Description Usage Arguments Value Author(s) See Also Examples

Description

morphology performs morphological operations on images of class asc.

Usage

1
morphology(x, operation = c("erode", "dilate"), nt = 5)

Arguments

x

a matrix of class asc

operation

a character string indicating the operation to be processed: either "erode" or "dilate"

nt

the number of times that the operation should be processed

Value

Returns a matrix of class asc, containing 1 when the pixel belong to one feature of the image and NA otherwise (see examples).

Author(s)

Clement Calenge clement.calenge@oncfs.gouv.fr

See Also

asc for further information on objects of class asc.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data(puechabon)
a <- getkasc(puechabon$kasc,"Elevation")

## dilatation
toto1 <- morphology(a, operation = "dilate", nt = 1)
toto2 <- morphology(a, operation = "dilate", nt = 2)
toto3 <- morphology(a, operation = "dilate", nt = 3)
toto5 <- morphology(a, operation = "dilate", nt = 5)
colo <- grey((1:5)/6)
image(toto5, col = colo[1])
image(toto3, add = TRUE, col = colo[2])
image(toto2, add = TRUE, col = colo[3])
image(toto1, add = TRUE, col = colo[4])
image(a, add = TRUE)

## erosion
colo <- grey((1:20)/21)
image(a, col = 1)
for (i in 1:19) {
  toto <- morphology(a, operation = "erode", nt = i)
  image(toto, add = TRUE, col = colo[i])
}

ClementCalenge/adehabitat documentation built on May 6, 2019, 12:02 p.m.