数字图像处理与应用 Class 3. 20200504
Lecture 3 Image Enhancement(Spatial Filtering)
Lecture 3 Image Enhancement(Spatial Filtering)
Basic of spatial filtering
Smoothing spatial filters 平滑
Smoothing linear filters 平滑线性滤波器
Order-statistics filters 统计排序滤波器
Sharpening spatial filters 锐化
1st derivative filters 一阶导
2nd derivative filters 二阶导
Basic
Any size rectangle and any shape filter are possible.
一般选择奇数(保证滤波器有中心点)/偶数需额外控制
Spatial Linear filters
a=(m-1)/2 and b=(n-1)/2
m x n (odd numbers)
一般化-->
Strange Things at the Edges
At the edges of an image we are missing pixels to form a neighbourhood
- Solutions
-Omit missing pixels
Can add extra code and slow down processing
-Pad the image 增补图片
Typically with either all white or all black pixels
-Replicate border pixels 复制边界像素
-Truncate the image 截断图像
Spatial smoothing filtering 空间平滑滤波
Used for blurring (removal of small details prior to large object extraction, bridging small gaps in lines) and noise reduction.
用于模糊化(在提取大对象之前去除小细节,消除线中的小间隙)和降噪。
Smoothing linear filters
averaging filter 均值滤波器
去噪,对于突出显著特征也很有用
Weighted averaging filter
出发点:
Pixels closer to the central pixel are more important
靠近中心像素的像素更重要
Often referred to as a weighted averaging
通常被称为加权平均
作用:减小锐化过渡、降噪、副作用-边缘模糊、减少"不相关细节"
Order-statistics filters 统计排序滤波器
统计排序滤波器是一种非线性空间滤波器,其响应是基于滤波器区域内像素点的排序。
Min、Max、Median:
Set the pixel value to the minimum/maximum/median in the neighbourhood
椒盐噪声,一般中值滤波比均值滤波效果更好。
eg. Gaussian noise;Salt and pepper noise
Max filter is good for pepper noise and min is good for salt noise
Other typical filter masks
Adaptive Filters 自适应滤波
到目前为止讨论的过滤器应用于整个图像,而不考虑图像特征如何从一点到另一点的变化;
自适应滤波器的性能取决于滤波器区域内图像的特性;
过滤器复杂性的增加;
Adaptive Median Filtering 自适应中值滤波
在脉冲噪声空间密度不大(Pa和Pb小于0.2)的情况下,中值滤波器对脉冲噪声的性能相对较好。
自适应中值滤波可以处理空间密度较大的脉冲噪声,并对非脉冲噪声进行一定的平滑处理。
自适应中值滤波器的另一个优点是,它在平滑非脉冲噪声的同时,力求保留细节。
自适应中值滤波器的关键在于滤波器大小的变化取决于图像的特征。
请记住,滤波将依次查看每个原始像素图像并生成一个新的经过滤波的像素。
理解算法的关键是要记住自适应中值滤波有三个目的:
Remove impulse noise 去除脉冲噪声
Provide smoothing of other noise 提供其他噪音的平滑
Reduce distortion, by not changing these intermediate-level points. (excessive thinning or thickening of object boundaries) 减少失真,不改变这些中间水平点。(物体边界过薄或过厚)
Sharpening Spatial Filters 锐化空间滤波器
1st Derivative
2nd Derivative
Comparing the 1st and 2nd derivatives we can conclude the following:
1st order derivatives generally produce thicker edges
2nd order derivatives have a stronger response to fine detail e.g. thin lines, and isolated points
1st order derivatives have stronger response to grey level step
2nd order derivatives produce a double response at step changes in grey level
Using Second Derivatives For Image Enhancement
二阶导数比一阶导数对图像增强更有用
对细节的强烈反应
简单的实现
The Laplacian
Isotropic
One of the simplest sharpening filters
Basic Concept
Application of Laplacian Image Enhancement
The result of a Laplacian filtering is not an enhanced image.
Subtract the Laplacian result from the original image to generate our final sharpened enhanced image.
Simplified Image Enhancement
The entire enhancement can be combined into a single filtering operation
一步实现
Variants On The Simple Laplacian 简单拉普拉斯的变体
Two definitions of Laplacian: one is the negative of the other
High Boost Filtering 高稳定性滤波
When A=1, it is the standard Laplacian filtering, as the value of A increase past 1, the contribution of the sharpening process becomes less and less important.
当A=1时,它是标准的拉普拉斯滤波,当A的值增加超过1时,锐化过程的贡献变得越来越小。
One of the principal applications of boost filtering is when the input image is darker than desired.
升压滤波的主要应用之一是当输入的图像比期望的颜色深。
By varying the boost coefficient, it generally is possible to obtain an overall increase in average gray level of the image.
通过改变升压系数,通常可以获得图像平均灰度的整体提升
1st Derivative Filtering
Implementing 1st derivative filters is difficult in practice
简化为
Roberts
Sobel Operators 索贝尔算子
To filter an image it is filtered using both operators the results of which are added together
为了过滤一个图像,它使用两个运算符进行过滤,将它们的结果加在一起
Sobel filters are typically used for edge detection Sobel过滤器通常用于边缘检测
成功的图像增强通常不是通过单一操作实现的。相反,我们结合一系列的技术,以达到最终的结果。