图像滤波器可以分为线性滤波器和非线性滤波器。线性滤波器中主要涉及的是低通滤波器和高通滤波器。低通滤波器(又称为平滑滤波器)是保留图像的主要信息,部分细节信息被舍弃,而高通滤波器则相反,用来提取图像的边缘等细节信息。
1.低通滤波器(low-pass filters 平滑滤波器)
平滑滤波器的主要形式是邻域内所有像素的加权平均值为当前像素的值,平滑滤波器的主要功能是可以将部分噪声值去除,但同时使得图像原本的部分细节信息丢失。平滑滤波器满足邻域内所有的权重和为1。
2.高通滤波器(high-pass filters)
How to enhance or sharpen images? The idea is simple, just strengthen edges of original image by adding a multiple of the edge map to it.
In image data, ∇2I(x,y)=f(x+1,y)+f(x−1,y)+f(x,y+1)+f(x,y−1)−4(x,y)
Here post a image enhancement example.
The edge filter we use is this, which detects both the x and y dimension edges.
so, the final filter J(x,y) is,
here shows the original image and sharpened image,
It is excited to see the image is sharpened, but brings much noise at the same time. So usually the alternative is just add a fraction of the edges, for a more subtle effect, which is called UNSHARP MASKING.
suppose the original image: F
low-pass image: F^
so high-pass image: F−F^=Fhp
the sharpened image: F+k∗Fhp
here shows the results and the codes.
It looks better than the before case.
lp = ones(3)/9;
>> ori = [0 0 0;0 1 0;0 0 0];
>> hp = ori - lp;
>> k = 0.6;
>> f = ori + k*hp;
>> out = imfilter(im, f);