我们首先来看一下bilateralFilter,双边滤波
具体查看:https://en.wikipedia.org/wiki/Bilateral_filter点击打开链接
A bilateral filter is a non-linear, edge-preserving and noise-reducing smoothing filter for images. The intensity value at each pixel in an image is replaced by a weighted average of intensity values from nearby pixels. This weight can be based on a Gaussian distribution. Crucially, the weights depend not only on Euclidean distance of pixels, but also on the radiometric differences (e.g. range differences, such as color intensity, depth distance, etc.). This preserves sharp edges by systematically looping through each pixel and adjusting weights to the adjacent pixels accordingly.
也就是说:双边滤波器是一种非线性,边缘保留和减除噪声的图像平滑滤波器。在图像的每个像素强度值处被从附近的像素强度值的加权平均来取代。这个权值可以是基于高斯分布的。关键的是,权重不仅取决于像素的欧几里得距离,而且也在辐射差异(比如,范围的差异,颜色强度,深度距离等)。这个在系统地遍历每个像素的过程中保留了锐利的边缘和相应调整相邻的像素的权重。
The bilateral filter is defined as双边滤波器的定义如下:
where the normalization term标准化的术语:
ensures that the filter preserves image energy and
As mentioned above, the weight is assigned using the spatial closeness and the intensity difference.[1] Consider a pixel located at which needs to be denoised in image using its neighbouring pixels and one of its neighbouring pixels is located at . Then, the weight assigned for pixel to denoise the pixel is given by:
where σd and σr are smoothing parameters and I(i, j) and I(k, l) are the intensity of pixels and respectively. After calculating the weights, normalize them.
where is the denoised intensity of pixel .
也就是说:权重指定使用空间的亲密度和强度差异。
The bilateral filter in its direct form can introduce several types of image artifacts:
There exist several extensions to the filter that deal with these artifacts. Alternative filters, like the guided filter ,have also been proposed as an efficient alternative without these limitations.存在几个扩展过滤器处理这些工件,选择过滤器,如引导过滤器,也被建议作为一种有效的替代没有这些限制
相关模型:The Bilateral filter was shown to be an application of the short time kernel of the Beltrami flow .See also.双边滤波器被证明是短时间的应用程序内核的贝尔特拉米流
With similar goal as the Bilateral filter, the class of edge-preserving smoothing filters also includes: Anisotropic Diffusion, the Weighted Least Squares framework,the Edge-Avoiding Wavelets,Geodesic editing,Guided filtering,and the Domain Transform framework.
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. The visual effect of this blurring technique is a smooth blur resembling that of viewing the image through a translucent screen, distinctly different from the bokeh effect produced by an out-of-focus lens or the shadow of an object under usual illumination. Gaussian smoothing is also used as a pre-processing stage in computer vision algorithms in order to enhance image structures at different scales—see scale space representation and scale space implementation.
Mathematically, applying a Gaussian blur to an image is the same as convolving the image with a Gaussian function. This is also known as a two-dimensional Weierstrass transform. By contrast, convolving by a circle (i.e., a circularbox blur) would more accurately reproduce the bokeh effect. Since the Fourier transform of a Gaussian is another Gaussian, applying a Gaussian blur has the effect of reducing the image's high-frequency components; a Gaussian blur is thus a low pass filter.
The Gaussian blur is a type of image-blurring filter that uses a Gaussian function (which also expresses the normal distribution in statistics) for calculating the transformation to apply to each pixel in the image. 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. When applied in two dimensions, this formula produces a surface whose contours are concentric circles with a Gaussian distribution from the center point. 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. This results in a blur that preserves boundaries and edges better than other, more uniform blurring filters; see also scale space implementation.
函数的拉普拉斯算子也是该函数的黑塞矩阵的迹,可以证明,它具有各向同性,即与坐标轴方向无关,坐标轴旋转后梯度结果不变。如果邻域系统是4 邻域,Laplacian 算子的模板为:
0 | 1 | 0 |
1 | -4 | 1 |
0 | 1 | 0 |
如果邻域系统是8 邻域,Laplacian 算子的模板为:
1 | 1 | 1 |
1 | -8 | 1 |
1 | 1 | 1 |
前面提过,Laplacian 算子对噪声比较敏感,所以图像一般先经过平滑处理,因为平滑处理也是用模板进行的,所以,通常的分割算法都是把Laplacian 算子和平滑算子结合起来生成一个新的模板。