Linearity:
An operator or system H is linear if two properties hold:
1. Additivity:
H(f1+f2) = H(f1) + H(f2)
2. scaling multiplicative
H(a*f1) = a*H(f1)
where f1, f2 are functions, a is a constant.
impulse function:
an idealized function whose area is 1.
its width is near to 0, but its height is +inf.
impulse response:
correlation and convolution
if filter is symmetric, the correlation filter and convolution filter is the same.
shift invariant - property of convolution operation
also, convolution is a linear operation.
at sometimes, filter is separable.
Boundary issues
full : dimensions of output image becames larger.
same: dimensions of output image remain the same.
valid: dimensions of output image decreased
% Explore edge options
pkg load image;
%% Load an image
img = imread('fall-leaves.png'); % also available: peppers.png, mandrill.png
imshow(img);
%% Create a Gaussian filter
height = 15;
sigma = 2;
filter_g = fspecial('gaussian', height, sigma);
%%
out_img = imfilter(img,filter_g,'symmetric'); % 0 replicate, circular, symmetric
imshow(out_img);
origin image: fill zeros:
circular:
symmetric
sharpen filter
加倍的像素值减去周围像素信息可以将图片锐化。
unsharp mask makes picture sharper.
median filter
% Apply a median filter
pkg load image;
%% Read an image
img = imread('moon.png'); % also try: brooklyn-bridge.png, penny-farthing.png
imshow(img);
%% Add salt & pepper noise
noiseimg = imnoise(img, 'salt & pepper', 2);
imshow(noiseimg);
img1 = medfilt2(noiseimg); % add median filter
imshow(img1);