seedfill               package:simecol               R Documentation

_C_o_l_o_r _F_i_l_l _A_l_g_o_r_i_t_h_m

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

     Fills a bounded area within a numeric matrix with a given number
     (color).

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

      seedfill(z, x=1, y=1, fcol=0, bcol=1, tol=1e-6)

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

       z: a matrix containing an image (double precision values are
          possible).

    x, y: start coordinates of the filled area.

    fcol: numeric value of the fill color.

    bcol: numeric value of the border value.

     tol: numeric value of border color tolerance.

_D_e_t_a_i_l_s:

     The function implements a basic color fill algorithm for use in
     image manipulation or cellular automata.

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

     A matrix with the same structure as 'z'.

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

     'neighbours'

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

     # define a matrix
     z<-matrix(0, nrow=20, ncol=20)

     # draw some lines
     z[10,]<-z[,10] <- 1
     z[5,] <-z[,5]  <- 3

     # plot matrix and filled variants
     par(mfrow=c(2, 2))
     image(z)
     image(seedfill(z))
     image(seedfill(z ,x=15, y=15, fcol=1, bcol=3))
     image(seedfill(z, x=7, y=7, fcol=3, bcol=1))

