filter2               package:EBImage               R Documentation

_2_D _C_o_n_v_o_l_u_t_i_o_n _F_i_l_t_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     Filters an image using the fast 2D FFT convolution product.

_U_s_a_g_e:

       filter2(x, filter)

_A_r_g_u_m_e_n_t_s:

       x: An 'Image' object or an array.

  filter: An 'Image' object or an array, with odd spatial dimensions.
          Must contain only one frame.

_D_e_t_a_i_l_s:

     Linear filtering is useful to perform low-pass filtering (to blur
     images, remove noise...) and high-pass filtering (to detect edges,
     sharpen images). The function 'makeBrush' is useful to generate
     filters.

     Data is reflected around borders.

     If 'x' contains multiple franes, the filter will be applied one
     each frame.

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     Gregoire Pau, gpau@ebi.ac.uk

_S_e_e _A_l_s_o:

     'makeBrush', 'convolve', 'fft', 'blur'

_E_x_a_m_p_l_e_s:

       x = readImage(system.file("images", "lena-color.png", package="EBImage"))
       if (interactive()) display(x, title='Lena')

       ## Low-pass disc-shaped filter
       f = makeBrush(21, shape='disc', step=FALSE)
       if (interactive()) display(f, title='Disc filter')
       f = f/sum(f)
       y = filter2(x, f)
       if (interactive()) display(y, title='Filtered lena')

       ## High-pass Laplacian filter
       la = matrix(1, nc=3, nr=3)
       la[2,2] = -8
       y = filter2(x, la)
       if (interactive()) display(y, title='Filtered lena')

