Tips:暂时还在学习matlab图像处理,写此小博客梳理相关知识。才疏学浅,还请读者见谅。
图像处理中的高斯滤波,通常来说是通过两步:
1、建立一个高斯模板T
在建立高斯模板时,通过高斯函数(也称正态分布函数)建立相应大小的模板(也即矩阵)。模板矩阵的特点是中心点的值最大,周围的值根据高斯函数(正态分布函数) 来确定。
个人感觉有时看别人的高斯模板,有些人有时候为了简化建立模板的过程,不调用高斯函数,建立值的分布与正态分布类似的模板,也可达到高斯滤波的效果,
如:
1/12 * [ 1 1 1
1 4 1
1 1 1 ]
矩阵前面有一个1/12相乘,也有相同的降噪和模糊细节的效果。
2、模板T与源图像S进行卷积
模板与源图像的卷积,其实就是两个矩阵之间的卷积。
一维高斯函数
***************同时以下内容摘抄来自维基百科****************
----From wikipedia
A Gaussian blur (also known as Gaussian smoothing) is the result of blurring an image by a Gaussian function. It is a widely used effect in graphics software, typically to reduce image noise and reduce detail.
高斯滤波通过高斯函数进行滤波,通常用在图像处理软件,尤其用于图像降噪和减少细节。
Mathematically, applying a Gaussian blur to an image is the same as convolving the image with a Gaussian function.
应用高斯滤波在数学上来说就是用高斯函数与图像卷积。
Gaussian blur is thus a low pass filter.
高斯滤波器是一个低通滤波器。
The equation of a Gaussian function in one dimension is
in two dimensions, it is the product of two such Gaussians, one in each dimension:
where x is the distance from the origin in the horizontal axis, y is the distance from the origin in the vertical axis, and σ is the standard deviation of the Gaussian distribution.
Values from this distribution are used to build a convolution matrix which is applied to the original image.Each pixel's new value is set to a weighted average of that pixel's neighborhood.
通过高斯分布函数,建立一个用于与源图像进行卷积的矩阵。每一个像素点卷积后新的值是由像素点周围像素的加权平均值得到。
The original pixel's value receives the heaviest weight (having the highest Gaussian value) and neighboring pixels receive smaller weights as their distance to the original pixel increases.
该点原始的像素值拥有最大的权重,周围像素点权重减小,且距离越远,权重越小。