watershed              package:EBImage              R Documentation

_W_a_t_e_r_s_h_e_d _t_r_a_n_s_f_o_r_m_a_t_i_o_n _a_n_d _w_a_t_e_r_s_h_e_d _b_a_s_e_d _o_b_j_e_c_t _d_e_t_e_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Watershed transformation and watershed based object detection.

_U_s_a_g_e:

       watershed(x, tolerance=1, ext=1)

_A_r_g_u_m_e_n_t_s:

       x: An 'Image' object or an array.

tolerance: The minimum height of the object in the units of image
          intensity between its highest point (seed) and the point
          where it contacts another object (checked for every contact
          pixel). If the height is smaller than the tolerance, the
          object will be combined with one of its neighbors, which is
          the highest. Tolerance should be chosen according to the
          range of 'x'. Default value is 1, which  is a reasonable
          value if 'x' comes from 'distmap'.

     ext: Radius of the neighborhood in pixels for the detection of
          neighboring objects. Higher value smoothes out small objects. 

_D_e_t_a_i_l_s:

     The algorithm identifies and separates objects that stand out of
     the background (zero). After the water fill, the source image is
     flipped upside down and the resulting valleys (values with higher
     intensities) are filled in first until another object or
     background is met. The deepest valleys (pixels with highest
     intensity) become indexed first, starting from 1.

     The function 'bwlabel' is a simpler, faster alternative to 
     segment connected objects from binary images.

_V_a_l_u_e:

     An 'Grayscale' 'Image' object or an array, containing the labelled
     version of 'x'.

_A_u_t_h_o_r(_s):

     Oleg Sklyar, osklyar@ebi.ac.uk, 2007

_S_e_e _A_l_s_o:

     'bwlabel',  'propagate'

_E_x_a_m_p_l_e_s:

       x = readImage(system.file('images', 'shapes.png', package='EBImage'))
       x = x[110:512,1:130]
       if (interactive()) display(x, title='Binary')
       y = distmap(x)
       if (interactive()) display(normalize(y), title='Distance map')
       w = watershed(y)
       if (interactive()) display(normalize(w), title='Watershed')

