autoThreshold             package:rtiff             R Documentation

_S_u_g_g_e_s_t_s _t_h_r_e_s_h_o_l_d _l_e_v_e_l_s _t_o _u_s_e _i_n _b_i_n_a_r_i_z_i_n_g _a_n _i_m_a_g_e _c_h_a_n_n_e_l.

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

     This is an implementation of the Ridler method for binarization
     (see references).

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

     autoThreshold(d.m, est = 0.5)

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

     d.m: A data matrix representing the pixel intensities for a single
          image channel (e.g. readTiff("image.tif")@red). 

     est: The initial thresholding estimate to work from.  The default
          only works if the pixel intensities are between 0 and 1,
          otherwise the mean intensity of the entire channel is likely
          a reasonable starting point.  The selection of the  estimate
          should not influence the final threshold selected. 

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

     A vector (v) of estimates, the 3rd element of which is the true
     Ridler estimate.  However, experience demonstrates that sometimes
     a lower (elements 1 or 2) or higher (elements 4 or 4) estimate
     performs better for a given application. The Ridler estimate is
     the mean between the average intensity of bright regions in the
     raster and the average intensity of dim regions.  This is v[3]. 
     v[1] is the average of dim regions, v[5] is the average of dim
     regions, and v[2] and v[4] are the mean between the Ridler
     estimate and v[1] and v[2], respectively.

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

     Eric Kort <eric.kort@vai.org>

_R_e_f_e_r_e_n_c_e_s:

     Ridler T, Calvard S. Picture thresholding using an iterative
     selection method. IEEE Trans on Systems Man and Cybernetics, SMC
     8;630-2.

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

     library(rtiff)
     tif <- readTiff(paste(.path.package("rtiff"), "/tiff/jello.tif", sep=""))
     threshold <- autoThreshold(tif@red)
     plot(tif)

     get(getOption("device"))()

     plot(tif@red > threshold[3])

