Local processing through masks

To apply a local processing through a mask:

g = imfilter(f, w, filter_mode, border_options, size_options)

where f is the original image, w is the mask, g is the resulting image, filter_mode is "corr" for correlation and "conv" for the case of convolution, size_options which has two size options "full" and "same", and border_options has several options:

Appplication of a mask

Filter creation

You can crate "standard" filters using MATLAB's Toolbox:

w = fspecial('type', parameters)

where type specifies the type of filter, and parameters specifies the details of said filter.

Options for type:

Laplacian filter applied to the image of the moon

Laplacian filter

Non-linear filter (median filter)

g = medfilt2(f, [m n], border_options)

where g is the resulting filtered image, f is the image to filter, [m n] is the size of the mask ([3 3] by default), and there are two border options: 'zeros', which is the default and 'symmetric'.

You can practice these concepts using snippet03.