小结:

1、卷积广泛存在与物理设备、计算机程序的smoothing平滑、sharpening锐化过程;

空间卷积可应用在图像处理中:函数f(原图像)经过滤器函数g形成新函数f-g(平滑化或锐利化的新图像)。

卷积可应用在物理设备、计算程序,对数据进行平滑化或锐利化。

空间卷积也应用于图像处理中的边缘检测、特征提取、动作提取、图形匹配等。

http://graphics.stanford.edu/courses/cs178/applets/convolution.html

Convolution of 1D functions

On the left side of the applet is a 1D function ("signal"). This is f. You can draw on the function to change it, but leave it alone for now. Beneath this is a menu of 1D filters. This is g. If you select "custom" you can also draw on the filter function, but leave that game for later. At the bottom is the result of convolving f by g. Click on a few of the filters. Notice that "big rect" blurs f more than "rect", but it leaves kinks here and there. Notice also that "gaussian" blurs less than "big rect" but doesn't leave kinks.

Both functions (f and g) are drawn as if they were functions of a continuous variable x, so it would appear that this visualization is showing convolution of continuous functions (first equation above). In practice the two functions are sampled finely and represented using 1D arrays. These numbers are connected using lines when they are drawn, giving the appearance of continuous functions. The convolution actually being performed in the applet's script is of two discrete functions (second equation above).

Whether we treat the convolution as continuous or discrete, its interpretation is the same: for each position x in the output function, we shift the filter function g left or right until it is centered at that position, we flip it left-to-right, we multiply every point on f by the corresponding point on our shifted g, and we add (or integrate) these products together. The left-to-right flipping is because, for obscure reasons, the equation for convolution is defined as g[x-k], not g[x+k] (using the 2nd equation as an example).

An alternative way to think about convolution

If this procedure is a bit hard to wrap your head around, here's an equivalent way to describe it that may be easier to visualize: at each position x in the output function, we place a copy of the filter g, centered left-to-right around that position, flipped left-to-right, and scaled up or down according to the value of the signal f at that position. After laying down these copies, if we add them all together at each x, we get the right answer!

To see this alternative way of understanding convolution in action, click on "animate", then "big rect". The animation starts with the original signal f, then places copies of the filter g at positions along f, stretching them vertically according to the height of f at that position, then adds these copies together to make the thick output curve. Although the animation only shows a couple dozen copies of the filter, in reality there would need to be one copy for every position x. In addition, for this procedure to work the sum of copies must be divided by the area under the filter function, a processing called normalization. Otherwise, the output would be higher or lower than the input, rather than simply being smoothed or sharpened. For all the filters except "custom", normalization is performed for you just before drawing the thick output curve. For the "custom" filter, see below.

Once you understand how this works, try the "sharpen" or "shift" filters. The sharpen filter replaces each value of f with a weighted sum of its immediate neighbors, but subtracting off the values of neighbors a bit further away. The effect of these subtractions is to exaggerate features in the original signal. The "Sharpen" filter in Photoshop does this; so do certain layers of neurons in your retina. The shift filter replaces each value of f with a value of f taken from a neighbor some distance to the right. (Yes, to the right, even though the spike in the filter is on the left side. Remember that convolution flips the filter function left-to-right before applying it.)

Finally, click on "custom" and try drawing your own filter. If the area under your filter is more or less than 1.0, the output function will jump up or down, respectively. To avoid this, click on "normalize". This will scale your filter up or down until its area is exactly 1.0. By the way, if you animate the application of your custom filter, the scaled copies will only touch the corresponding point on the original function if your custom filter reached y=1.0 at its x=0 position. Regardless, if your filter is normalized, the output function will be of the right height.

Convolution of 2D functions

On the right side of the applet we extend these ideas to two-dimensional discrete functions, in particular ordinary photographic images. The original 2D signal is at top, the 2D filter is in the middle, depicted as an array of numbers, and the output is at the bottom. Click on the different filter functions and observe the result. The only difference between "sharpen" and "edges" is a change of the middle filter value from 9.00 to 8.00. However, this change is crucial, as you can see. In particular, the sum of all non-zero filter values in "edges" is zero. Therefore, for positions in the original signal that are smooth (like the background), the output of the convolution is zero (i.e. black). The filter "hand shake" approximates what happens in a long-exposure photograph, in this case if the camera's aim wanders from upper-left to lower-right during the exposure.

Finally, click on "identity", which sets the middle filter tap (as positions in a filter are sometimes called) to 1.0 and the rest to 0.0. It should come as no surprise that this merely makes a copy of the original signal. Now click on "custom", then click on individual taps and enter new values for them. As you enter each value, the convolution is recomputed. Try creating a smoothing filter, or a sharpening filtering. Or starting with "identity", change the middle tap to 0.5, or 2.0. Does the image scale down or up in intensity? The applet is clipping outputs at 0.0 (black) and 255.0 (white), so if you try to scale intensites up, the image will simply saturate - like a camera if your exposure were too long. Try putting 1.0's in the upper-left corner and the lower right corner, setting everything else to 0.0. Do you get a double image? As with the custom 1D filter, if your filter values don't sum to 1.0, you might need to press "normalize". Unless you're doing edge finding, in which case they should sum to 0.0.


Questions or Comments? Please e-mail us.
© 2010;
Marc Levoy

Last update:

March 1, 2012 12:59:44 AM

Return to index of applets

Spatial convolution的更多相关文章

  1. SCNN车道线检测--(SCNN)Spatial As Deep: Spatial CNN for Traffic Scene Understanding(论文解读)

    Spatial As Deep: Spatial CNN for Traffic Scene Understanding 收录:AAAI2018 (AAAI Conference on Artific ...

  2. 论文笔记—Flattened convolution neural networks for feedforward acceleration

    1. 论文思想 一维滤过器.将三维卷积分解成三个一维卷积.convolution across channels(lateral), vertical and horizontal direction ...

  3. 从图(Graph)到图卷积(Graph Convolution):漫谈图神经网络模型 (二)

    本文属于图神经网络的系列文章,文章目录如下: 从图(Graph)到图卷积(Graph Convolution):漫谈图神经网络模型 (一) 从图(Graph)到图卷积(Graph Convolutio ...

  4. “卷积神经网络(Convolutional Neural Network,CNN)”之问

    目录 Q1:CNN 中的全连接层为什么可以看作是使用卷积核遍历整个输入区域的卷积操作? Q2:1×1 的卷积核(filter)怎么理解? Q3:什么是感受野(Receptive field)? Q4: ...

  5. 论文笔记——Factorized Convolutional Neural Networks

    1. 论文思想 将3D卷积分解为spatial convolution in each channel and linear projection across channels. (spatial ...

  6. [Network Architecture]Xception 论文笔记(转)

    文章来源 论文:Xception: Deep Learning with Depthwise Separable Convolutions 论文链接:https://arxiv.org/abs/161 ...

  7. 函数的光滑化或正则化 卷积 应用 两个统计独立变量X与Y的和的概率密度函数是X与Y的概率密度函数的卷积

    http://graphics.stanford.edu/courses/cs178/applets/convolution.html Convolution is an operation on t ...

  8. Graph Embedding Review:Graph Neural Network(GNN)综述

    作者简介: 吴天龙  香侬科技researcher 公众号(suanfarensheng) 导言 图(graph)是一个非常常用的数据结构,现实世界中很多很多任务可以描述为图问题,比如社交网络,蛋白体 ...

  9. 实战级Stand-Alone Self-Attention in CV,快加入到你的trick包吧 | NeurIPS 2019

    论文提出stand-alone self-attention layer,并且构建了full attention model,验证了content-based的相互关系能够作为视觉模型特征提取的主要基 ...

随机推荐

  1. python内置函数之print()

    定义:将值打印到一个流对象,或者默认打印到sys.stdout. 语法: print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=Fal ...

  2. C#和sqlserver中生成新的32位GUID

    C#中用Guid.NewGuid().ToString() Sql中用NEWID() 以上方法生成的是36位的GUID,如果需要转换成32位,则需要替换掉其中的'-'字符. Sql中的方法:repla ...

  3. django 文件上传(阿里云oss)下载(支持大文件下载)

    1.文件上传 Models 设计 class Upload_File(models.Model): image = models.FileField(upload_to='file/%Y/%m',de ...

  4. sql server自定义函数

    CREATE function [dbo].[f_testFunc]( ) ,) ) ) as begin ); ); ); ); SELECT @str_id = a.id,@str_code = ...

  5. linux系统中/etc/syslog.conf文件解读

    1: syslog.conf的介绍 对于不同类型的Unix,标准UnixLog系统的设置,实际上除了一些关键词的不同,系统的syslog.conf格式是相同的.syslog采用可配置的.统一的系统登记 ...

  6. postgresql data数据目录路径迁移

    默认的数据库路径是/var/lib/pgsql/9.x/data 将现有的数据库文件全部拷贝到新的数据库路径下,然后重启 新建一个路径作为新的数据库数据路径,假如是/home/data sudo mk ...

  7. PHP高并发的解决方案

    这几天面试,被问到这样一个问题:如何解决大流量的高并发问题.起初不知所措,在查阅相关资料,以及网上大牛们的解答之后,总结出以下几点: 1.服务器,如果同时访问量超过10W的话,需要采用专用服务器来承载 ...

  8. JAVASCRIPT+DHTML实现表格拖动

    自已做的,本来想在网上找前辈们做的,可是总找不到这种例子,要么找出来的太复杂, 要么就没法用,索性自己写了一个.看看还可以用!贡献出来,估计和我一样的菜鸟用的着! <html> <s ...

  9. shell 中各种符号的含义

    http://yesjavame.iteye.com/blog/1062405 http://blog.csdn.net/taiyang1987912/article/details/39551385

  10. expected_conditions判断页面元素

    expected_condtions提供了16种判断页面元素的方法: 1.title_is:判断当前页面的title是否完全等于预期字符串,返回布尔值 2.title_contains:判断当前页面的 ...