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')

