更新时间:2022-05-24 21:12:52
首先使用 fspecial 然后使用 imfilter (适用于多维图片,如同例)。
You first create the filter with fspecial and then convolve the image with the filter using imfilter (which works on multidimensional images as in the example).
您在 sigma 和 hsize
$ c> fspecial 。
You specify sigma
and hsize
in fspecial
.
%%# Read an image
I = imread('peppers.png');
%# Create the gaussian filter with hsize = [5 5] and sigma = 2
G = fspecial('gaussian',[5 5],2);
%# Filter it
Ig = imfilter(I,G,'same');
%# Display
imshow(Ig)