Nearest neighboring pixels have the most influence
F(x, y)
H(u, v)
1 2 1
2 4 2
1 2 1
this kernel is an approximation of a Gaussian function
h(u, v) = 1/2πσ^2 e ^(- u^2+v^2/σ^2)
Gaussian filters
Variance(σ^2), standard deviation(σ): determines extent of smoothing
hsize = 31;
sigma = 5;
h = fspecial('gaussian', hsize, sigma);
surf(h);
imagesc(h);
outim = imfilter(im, h);
imshow(outim);
for sigma = 1:3:10
h = fspecial('gaussian', fsize, sigma);
out = imfilter(im, h);
imshow(out);
pause;
end
img = imread('saturn.png');
imshow(img);
noise = randn(size(img)) .* 25;
noisy_img = img + noise;
imshow(noisy_img);
filter_size = 11;
filter_sigma = 2;
pkg load image;
filter = fspecial('gaussian', filter_size, filter_sigma);
smoothed = imfilter(noisy_img, filter);
When filtering with a Gaussian, the sigma is most important- it defines the blur kernel’s scale with respect to the image.
Altering the normalization coefficient does not effect the blur, only the brightness.