imfilter
Applies a linear filter on image data.
Syntax
h = imfilter(data, filter)
h = imfilter(data, filter, method)
Inputs
- data
- Data on which linear filtering is applied. Must be a real, non-sparse 2 dimensional or multi-dimensional matrix.
- filter
- Linear filter. Must be a real, non-sparse 2 dimensional matrix.
- method
- Method used to apply the filtering. Valid values are 'corr'(default) and 'conv'. 'corr' applies the filter using correlation and 'conv' applies the filter using convolution.
Outputs
- h
- Filtered image data.
Example
Apply a Gaussian filter using convolution:
close all;
linearfilter = fspecial('gaussian', 3, 0.5);
handle = imreadcv('imfilter_1.png');
data = getcv(handle);
filteredimage = imfilter(data, linearfilter, 'conv');
figure(1);
imshowcv(data);
figure(2);
imshowcv(filteredimage);