高斯模糊-Gaussian blur

高斯模糊

从维基百科,自由的百科全书
一个小的和大的高斯模糊效果

A高斯模糊(也被称为高斯平滑)是模糊图像的结果高斯函数。它是一种广泛使用的图形软件的影响,通常会减少图像噪声和减少细节。这个模糊技术的视觉效果是一个平滑的模糊相似,查看图片通过一个半透明的屏幕,从明显不同散景在通常的照明的聚焦透镜或物体的阴影产生的影响。高斯平滑也被用来作为一个预处理阶段计算机视觉算法以提高图像在不同尺度的结构见尺度空间表示和尺度空间的实现。

在数学上,应用高斯模糊图像是一样的卷积一个图像高斯函数。这也被称为一个二维维尔斯特拉斯变换。相比之下,通过循环卷积(即,一个圆盒子模糊)能更准确地再现散景功效自傅里叶变换一个高斯是另一个高斯,应用高斯模糊具有降低图像的高频成分的影响;高斯模糊是一个低通滤波器。

目录

   [hide] 
  • 1 机械
  • 2 低通滤波器
  • 3 的方差减少
  • 4 样品高斯矩阵
  • 5 实现
  • 6 常见的用途
  • 7 参见
  • 8 注释和参考文献
  • 9 外部链接

机械编辑]

高斯模糊可以用在为了获得平滑的灰度数字图像的 半色调打印

高斯模糊是一种图像模糊滤波器,利用高斯函数(这也表示正态分布在统计)计算变换适用于图像中的每个像素。高斯函数的一维的方程

在两个维度,它是两个这样的高斯产品,一个在每个维度:

【1] 【2]

在哪儿X从原点的距离在水平轴,Y从原点的距离的垂直轴,和σ是的标准偏差的高斯分布。当施加在两个维度,这个公式产生的表面轮廓是同心圆从中心点的高斯分布。从这个分布值被用来建立一个卷积矩阵应用到原始图像。每个像素的值设置为加权平均该像素的邻域。原始像素的值受到重的重量(具有最高的高斯值)和邻近的像素获得较小的权重作为他们的距离原来的像素的增加。这样的结果是一个模糊的边界和边缘保持比其它的更好,更均匀的模糊过滤器;参见尺度空间的实现。

在理论上,在图像中的每个点的高斯函数将非零,这意味着整个图像需要被包括在计算中的每个像素。在实践中,当计算的高斯函数的离散近似,在距离超过3像素σ小到足以被认为是有效的零。因此从这个范围之外的像素的贡献可以忽略。通常,图像处理程序只需要计算一个矩阵的尺寸×(在哪里是的上限函数)确保结果十分接近,整个高斯分布。

除了是圆对称高斯模糊,可应用于二维图像作为两个独立的一维计算,所以被称为可分离的过滤器。那是,使用二维矩阵的影响也可以运用在水平方向上的一系列的一维高斯矩阵实现,然后重复这个过程,在垂直方向。在计算方面,这是一个有用的特性,因为计算可以执行时间(的地方H是高度W是看到的宽度;大O符号),而不是对于非可分离内核。

应用多,连续的高斯模糊图像具有相同的效果,采用一个单一的,更大的高斯模糊,其半径是对模糊半径被实际应用的平方和的平方根。例如,应用连续高斯模糊与6和8的半径,给出相同的结果作为应用一个半径为10的高斯模糊,因为。因为这个关系,处理时间不能通过模拟一个连续的高斯模糊了较小的模糊,所需要的时间将至少执行单个大模糊一样大。

两个缩小的图像的 英联邦国家的国旗。在降尺度,高斯模糊应用于底部的图像而不是顶部的图像。模糊使图像不太清晰,但防止形成 莫尔é模式混叠假象。

高斯模糊通常在降低图像的大小。当下采样一个图像,它是常见的应用的一个低通滤波器之前的图像重采样。这是为了确保虚假的高频信息不会出现在下采样的图像(别名)。高斯模糊有很好的性能,如没有锋利的边缘,因此不会引入到滤波图像振铃。

低通滤波器编辑]

高斯模糊是一个低通滤波器高频率的信号,衰减。

它的振幅Bode图(的对数刻度在频率域)是一个抛物线。

的方差减少编辑]

高斯滤波器与标准偏差是多少流畅的画面,与其他的话,这多少减少图片的像素值的标准偏差?假设像素灰度值的标准偏差,然后应用过滤器减少标准偏差可以近似为

样品高斯矩阵编辑]

这是一个样本矩阵,通过采样高斯滤波器内核产生(与σ= 0.84089642)在每个像素的中点,然后归一化。注意的中心元件(在[ 0,0 ])有最大的价值,减少对称的中心距离的增加。

0.00000067 0.00002292 0.00019117 0.00038771 0.00019117 0.00002292 0.00000067
0.00002292 0.00078634 0.00655965 0.01330373 0.00655965 0.00078633 0.00002292
0.00019117 0.00655965 0.05472157 0.11098164 0.05472157 0.00655965 0.00019117
0.00038771 0.01330373 0.11098164 0.22508352 0.11098164 0.01330373 0.00038771
0.00019117 0.00655965 0.05472157 0.11098164 0.05472157 0.00655965 0.00019117
0.00002292 0.00078633 0.00655965 0.01330373 0.00655965 0.00078633 0.00002292
0.00000067 0.00002292 0.00019117 0.00038771 0.00019117 0.00002292 0.00000067

请注意,0.22508352(中央)是1177倍大于0.00019117的外面是3σ。

实现编辑]

高斯模糊效果通常的卷积的图像与高斯内核生成的值。在实践中,最好是利用高斯模糊的分离性的过程划分成两道。在第一关,一个一维的内核使用模糊的图像在水平或垂直方向。在第二次,一个一维的内核是用来在剩余的方向模糊。由此产生的影响是卷积通过在一个单一的二维核相同,但需要较少的计算。

离散化通常是由离散点采样的高斯滤波器内核来实现,通常在位置对应于每个像素的中点。这减少了计算成本,但是,对于非常小的滤波器内核,点非常少的样本抽样的高斯函数会导致较大的误差。在这些情况下,精度保持(在一个小的计算成本)用高斯功能集成在每个像素的面积。【3]

当将高斯的连续值为内核的离散值,该值的总和将不同于1。这将导致的图像变暗或亮。为了解决这个问题,该值可以除以每个学期在内核中的内核中的所有项的总和归一化。

常见的用途编辑]

这说明边缘检测的平滑的影响。更平滑,更少的边缘检测

与常用的高斯平滑边缘检测。大多数的边缘检测算法对噪声敏感;二维拉普拉斯滤波器,建立从离散的拉普拉斯算子在嘈杂的环境中,是高度敏感的。使用高斯模糊滤镜在图像边缘检测的目的是减少图像中的噪声水平,提高了边缘检测算法的结果如下。这种方法通常被称为高斯拉普拉斯算子,或日志过滤。【4]

参见编辑]

  • 图像噪声
  • 高斯滤波器
  • 高斯金字塔
  • 无限脉冲响应(IIR)
  • 尺度空间的实现
  • 中值滤波
  • GNU Octave fspecial函数

注释和参考文献编辑]

  1. Jump up^ 夏皮罗,L. G.饲养员,G. C:“计算机视觉”,137页,150。清华大学出版社,2001
  2. Jump up^ 马克·尼克松和阿尔伯托·阿瓜多。特征提取和图像处理。学术出版社,2008,p. 88。
  3. Jump up^ 埃里克莱因哈德。高动态范围成像采集,显示,和基于图像的照明。摩根著,2006,页233–234。
  4. Jump up^ 费舍尔,帕金斯,沃克和wolfart(2003)。“空间滤波器的拉普拉斯高斯”。检索2010-09-13

外部链接编辑]

  • 一个可分离高斯模糊滤镜GLSL实现。
  • 的例子高斯模糊(低通滤波)应用于木刻,蚀刻为了消除图像对比的细节。
  • Mathematicagaussianfilter功能

原文

Gaussian blur

From Wikipedia, the free encyclopedia
The effects of a small and a large Gaussian blur

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 thebokeh 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 circular box 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.

Contents

   [hide] 
  • 1 Mechanics
  • 2 Low-pass filter
  • 3 Variance reduction
  • 4 Sample Gaussian matrix
  • 5 Implementation
  • 6 Common uses
  • 7 See also
  • 8 Notes and references
  • 9 External links

Mechanics[edit]

Gaussian blur can be used in order to obtain a smooth grayscale digital image of a  halftone print

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:

[1] [2]

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 thestandard deviation of the Gaussian distribution. When applied in two dimensions, this formula produces a surface whosecontours are concentric circles with a Gaussian distribution from the center point. Values from this distribution are used to build aconvolution 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.

In theory, the Gaussian function at every point on the image will be non-zero, meaning that the entire image would need to be included in the calculations for each pixel. In practice, when computing a discrete approximation of the Gaussian function, pixels at a distance of more than 3σ are small enough to be considered effectively zero. Thus contributions from pixels outside that range can be ignored. Typically, an image processing program need only calculate a matrix with dimensions  × (where  is the ceiling function) to ensure a result sufficiently close to that obtained by the entire gaussian distribution.

In addition to being circularly symmetric, the Gaussian blur can be applied to a two-dimensional image as two independent one-dimensional calculations, and so is termed separable filter. That is, the effect of applying the two-dimensional matrix can also be achieved by applying a series of single-dimensional Gaussian matrices in the horizontal direction, then repeating the process in the vertical direction. In computational terms, this is a useful property, since the calculation can be performed in  time (where h is height and w is width; see Big O notation), as opposed to  for a non-separable kernel.

Applying multiple, successive gaussian blurs to an image has the same effect as applying a single, larger gaussian blur, whose radius is the square root of the sum of the squares of the blur radii that were actually applied. For example, applying successive gaussian blurs with radii of 6 and 8 gives the same results as applying a single gaussian blur of radius 10, since . Because of this relationship, processing time cannot be saved by simulating a gaussian blur with successive, smaller blurs — the time required will be at least as great as performing the single large blur.

Two downscaled images of the  Flag of the Commonwealth of Nations. Before downscaling, a Gaussian blur was applied to the bottom image but not to the top image. The blur makes the image less sharp, but prevents the formation of  Moiré pattern aliasing artifacts.

Gaussian blurring is commonly used when reducing the size of an image. When downsampling an image, it is common to apply a low-pass filter to the image prior to resampling. This is to ensure that spurious high-frequency information does not appear in the downsampled image (aliasing). Gaussian blurs have nice properties, such as having no sharp edges, and thus do not introduce ringing into the filtered image.

Low-pass filter[edit]

Gaussian blur is a low-pass filter, attenuating high frequency signals.

Its amplitude Bode plot (the log scale in the frequency domain) is a parabola.

Variance reduction[edit]

How much does a Gaussian filter with standard deviation  smooth the picture, with other words, how much does it reduce the standard deviation of pixel values in the picture? Assume the grayscale pixel values have a standard deviation , then after applying the filter the reduced standard deviation  can be approximated as

.

Sample Gaussian matrix[edit]

This is a sample matrix, produced by sampling the Gaussian filter kernel (with σ = 0.84089642) at the midpoints of each pixel and then normalizing. Note that the center element (at [0, 0]) has the largest value, decreasing symmetrically as distance from the center increases.

0.00000067 0.00002292 0.00019117 0.00038771 0.00019117 0.00002292 0.00000067
0.00002292 0.00078634 0.00655965 0.01330373 0.00655965 0.00078633 0.00002292
0.00019117 0.00655965 0.05472157 0.11098164 0.05472157 0.00655965 0.00019117
0.00038771 0.01330373 0.11098164 0.22508352 0.11098164 0.01330373 0.00038771
0.00019117 0.00655965 0.05472157 0.11098164 0.05472157 0.00655965 0.00019117
0.00002292 0.00078633 0.00655965 0.01330373 0.00655965 0.00078633 0.00002292
0.00000067 0.00002292 0.00019117 0.00038771 0.00019117 0.00002292 0.00000067

Note that 0.22508352 (the central one) is 1177 times larger than 0.00019117 which is just outside 3σ.

Implementation[edit]

A Gaussian blur effect is typically generated by convolving an image with a kernel of Gaussian values. In practice, it is best to take advantage of the Gaussian blur’s separable property by dividing the process into two passes. In the first pass, a one-dimensional kernel is used to blur the image in only the horizontal or vertical direction. In the second pass, another one-dimensional kernel is used to blur in the remaining direction. The resulting effect is the same as convolving with a two-dimensional kernel in a single pass, but requires fewer calculations.

Discretisation is typically achieved by sampling the Gaussian filter kernel at discrete points, normally at positions corresponding to the midpoints of each pixel. This reduces the computational cost but, for very small filter kernels, point sampling the Gaussian function with very few samples leads to a large error. In these cases, accuracy is maintained (at a slight computational cost) by integration of the Gaussian function over each pixel's area.[3]

When converting the Gaussian’s continuous values into the discrete values needed for a kernel, the sum of the values will be different from 1. This will cause a darkening or brightening of the image. To remedy this, the values can be normalized by dividing each term in the kernel by the sum of all terms in the kernel.

Common uses[edit]

This shows how smoothing affects edge detection. With more smoothing, fewer edges are detected

Gaussian smoothing is commonly used with edge detection. Most edge-detection algorithms are sensitive to noise; the 2-D Laplacian filter, built from a discretization of the Laplace operator, is highly sensitive to noisy environments. Using a Gaussian Blur filter before edge detection aims to reduce the level of noise in the image, which improves the result of the following edge-detection algorithm. This approach is commonly referred to as Laplacian of Gaussian, or LoG filtering.[4]

See also[edit]

  • Image noise
  • Gaussian filter
  • Gaussian pyramid
  • Infinite impulse response (IIR)
  • Scale space implementation
  • Median filter
  • GNU Octave fspecial function

Notes and references[edit]

  1. Jump up^ Shapiro, L. G. & Stockman, G. C: "Computer Vision", page 137, 150. Prentice Hall, 2001
  2. Jump up^ Mark S. Nixon and Alberto S. Aguado. Feature Extraction and Image Processing. Academic Press, 2008, p. 88.
  3. Jump up^ Erik Reinhard. High dynamic range imaging: Acquisition, Display, and Image-Based Lighting. Morgan Kaufmann, 2006, pp. 233–234.
  4. Jump up^ Fisher, Perkins, Walker & Wolfart (2003). "Spatial Filters - Laplacian of Gaussian". Retrieved 2010-09-13.

External links[edit]

  • GLSL implementation of a separable gaussian blur filter.
  • Example for Gaussian blur (low pass filtering) applied to a wood-block print and an etching in order to remove details for picture comparison.
  • Mathematica GaussianFilter function

你可能感兴趣的:(blur,gaussian)