morphology            package:adehabitat            R Documentation

_M_o_r_p_h_o_l_o_g_y: _E_r_o_s_i_o_n _o_r _D_i_l_a_t_a_t_i_o_n _o_f _F_e_a_t_u_r_e_s _o_n _a _R_a_s_t_e_r _M_a_p

_D_e_s_c_r_i_p_t_i_o_n:

     'morphology' performs morphological operations on images of class
     'asc'.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

       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

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     Clment Calenge calenge@biomserv.univ-lyon1.fr

_S_e_e _A_l_s_o:

     'as.asc' for further information on objects of class 'asc'

_E_x_a_m_p_l_e_s:

     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)
     image(toto5, col = "red")
     image(toto3, add = TRUE, col = "orange")
     image(toto2, add = TRUE, col = "yellow")
     image(toto1, add = TRUE, col = "green")
     image(a, add = TRUE)

     ## erosion
     image(a, col = 1)
     for (i in 1:19) {
       toto <- morphology(a, operation = "erode", nt = i)
       image(toto, add = TRUE, col = palette()[(i+1)%%8])
     }

