Spatial Filters

图像滤波器可以分为线性滤波器和非线性滤波器。线性滤波器中主要涉及的是低通滤波器和高通滤波器。低通滤波器(又称为平滑滤波器)是保留图像的主要信息,部分细节信息被舍弃,而高通滤波器则相反,用来提取图像的边缘等细节信息。

1.低通滤波器(low-pass filters 平滑滤波器)
平滑滤波器的主要形式是邻域内所有像素的加权平均值为当前像素的值,平滑滤波器的主要功能是可以将部分噪声值去除,但同时使得图像原本的部分细节信息丢失。平滑滤波器满足邻域内所有的权重和为1。

Spatial Filters_第1张图片

下图为原图与依次使用两个平滑过滤器的效果。
Spatial Filters_第2张图片

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.

J(x,y)=I(x,y)+2I(x,y)

I(x,y) means original image, 2I(x,y) is the 2nd derivative of the image. Why here use the derivative concept? In fact, for signal data, the 1st derivative usually means change occurs, but the 2nd derivative detect sign changes near edges. Blow example shows four edges change, and the number refers the change intensity.

Spatial Filters_第3张图片

In image data, 2I(x,y)=f(x+1,y)+f(x1,y)+f(x,y+1)+f(x,y1)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.

Spatial Filters_第4张图片

so, the final filter J(x,y) is,
Spatial Filters_第5张图片

here shows the original image and sharpened image,
Spatial Filters_第6张图片

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: FF^=Fhp
the sharpened image: F+kFhp

here shows the results and the codes.

Spatial Filters_第7张图片

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);

你可能感兴趣的:(图像处理)