channels-methods           package:pixmap           R Documentation

_M_e_t_h_o_d_s _f_o_r _C_h_a_n_n_e_l _M_a_n_i_p_u_l_a_t_i_o_n

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

     Functions for manipulation and extraction of colors from
     channel-based pixmap formats. Methods for generic 'addChannels'
     adds the color channels of a colored pixmap and returns a grey
     version. Methods for generic 'getChannels' return numeric matrices
     or arrays containing the specified channels.

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

       addChannels(object, coef = NULL)
       getChannels(object, colors = "all")

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

  object: Object of class '"pixmap"'.

    coef: Coefficients for the color channels, a numeric vercot with as
          many elements as there are color channels in the pixmap. The
          default for RGB is 'c(0.30, 0.59, 0.11)', which makes a
          luminance-based conversion from color to grey.

  colors: Character vector naming the color channels that shall be
          extracted. The default of '"all"' returns all channels
          simultaneously.

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

     Friedrich Leisch

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

       x <- pixmapRGB(rep(1:5, 3), nrow=4)
       plot(x)
       print(x)

       getChannels(x)
       getChannels(x, colors=c("red", "green"))

       y = addChannels(x)
       plot(y)
       print(y)

       ## extract only the red channel
       y = addChannels(x, coef=c(1,0,0))
       plot(y)

