且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MATLAB中的高斯滤波器

更新时间: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)