图像处理中的高通滤波与低通滤波

                          图像处理中的高通滤波与低通滤波

High pass filter

A high pass filter (HPF) is a filter that examines a region of an image and boosts

the intensity of certain pixels based on the difference in the intensity with the

surrounding pixels.

Take, for example, the following kernel:

[[0, -0.25, 0],

[-0.25, 1, -0.25],

[0, -0.25, 0]]

 

After calculating the sum of differences of the intensities of the central pixel

compared to all the immediate neighbors, the intensity of the central pixel will be

boosted (or not) if a high level of changes are found. In other words, if a pixel stands

out from the surrounding pixels, it will get boosted.

This is particularly effective in edge detection, where a common form of HPF called

high boost filter is used.

 

Here, the pixel of interest has a weight of 9 and its immediate neighbors each

have a weight of -1. For the pixel of interest, the output color will be nine times

its input color minus the input colors of all eight adjacent pixels. If the pixel

of interest is already a bit different from its neighbors, this difference becomes

intensified. The effect is that the image looks sharper as the contrast between the

neighbors is increased.

 

Note that both filters sum up to 0, the reason for this is

explained in detail in the Edge detection section.

If we modify a sharpening kernel slightly so that its weights sum up to 0 instead, we have an edge detection kernel that turns edges white and non-edges black.

array([[-1, -1, -1],

[-1, 9, -1],

[-1, -1, -1]])

这个模板其权重之和为1.在图像非高频部分作用于该模板之后,中心像素所得的灰度值总是非零灰度值,和周边像素一样;而高频部分作用于改模板之后,中心像素的灰度值得到了增强,但也是非零灰度值。对于查找边缘或锐化而言,是无法区分图像的边缘或图像的高频部分。

 

所以,修改该模板使得其权重之和为0.这样边缘部分经过该模板之后,中心像素变成白色或者说有灰度值;非边缘部分经过该模板卷积之后,中心像素的灰度值变为0,这样就可以很好的区别边缘和非边缘部分了。2019.1.11

 

Low pass filter

If an HPF boosts the intensity of a pixel, given its difference with its neighbors, a

low pass filter (LPF) will smoothen the pixel if the difference with the surrounding

pixels is lower than a certain threshold. This is used in denoising and blurring. For

example, one of the most popular blurring/smoothening filters, the Gaussian blur,

is a low pass filter that attenuates the intensity of high frequency signals.

Take, for example, the following kernel:

\frac{1}{9}\begin{bmatrix} 1 1 1\\ 1 1 1\\ 1 1 1 \end{bmatrix}

以上是均值滤波模板,各个权重权重值都相等。对于高斯滤波而言,模板中靠近中心像素的权重值比远离中心像素的权重值要大,但是其所有权重值相加之后也应该也是为1.因为高斯滤波作为低通滤波器而言,仍然需要将中心像素灰度值向邻域内的像素的灰度值靠拢。

 

图像中的边缘、细节部分属于图像的高频信息;图像的非边缘、细节部分属于图像的低频信息。高通滤波器的作用顾名思义,就是可以让高频信号通过的滤波器,低通滤波器就是让低频信号通过的滤波器。

 

在上述高通滤波器模板中,如果中心像素的灰度值大于邻域内其他像素,那么中心像素通过高通滤波器之后其灰度值将被增加;反之,低通滤波器中,如果中心像素的灰度值大于邻域其他像素的灰度值,那么中心像素的灰度值将会向周边邻域内像素灰度值大小靠拢。

 

发布了49 篇原创文章 · 获赞 138 · 访问量 30万+

猜你喜欢

转载自blog.csdn.net/lz0499/article/details/88410858