Spatial convolution
小结:
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
Spatial convolution的更多相关文章
- 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 ...
- 论文笔记—Flattened convolution neural networks for feedforward acceleration
1. 论文思想 一维滤过器.将三维卷积分解成三个一维卷积.convolution across channels(lateral), vertical and horizontal direction ...
- 从图(Graph)到图卷积(Graph Convolution):漫谈图神经网络模型 (二)
本文属于图神经网络的系列文章,文章目录如下: 从图(Graph)到图卷积(Graph Convolution):漫谈图神经网络模型 (一) 从图(Graph)到图卷积(Graph Convolutio ...
- “卷积神经网络(Convolutional Neural Network,CNN)”之问
目录 Q1:CNN 中的全连接层为什么可以看作是使用卷积核遍历整个输入区域的卷积操作? Q2:1×1 的卷积核(filter)怎么理解? Q3:什么是感受野(Receptive field)? Q4: ...
- 论文笔记——Factorized Convolutional Neural Networks
1. 论文思想 将3D卷积分解为spatial convolution in each channel and linear projection across channels. (spatial ...
- [Network Architecture]Xception 论文笔记(转)
文章来源 论文:Xception: Deep Learning with Depthwise Separable Convolutions 论文链接:https://arxiv.org/abs/161 ...
- 函数的光滑化或正则化 卷积 应用 两个统计独立变量X与Y的和的概率密度函数是X与Y的概率密度函数的卷积
http://graphics.stanford.edu/courses/cs178/applets/convolution.html Convolution is an operation on t ...
- Graph Embedding Review:Graph Neural Network(GNN)综述
作者简介: 吴天龙 香侬科技researcher 公众号(suanfarensheng) 导言 图(graph)是一个非常常用的数据结构,现实世界中很多很多任务可以描述为图问题,比如社交网络,蛋白体 ...
- 实战级Stand-Alone Self-Attention in CV,快加入到你的trick包吧 | NeurIPS 2019
论文提出stand-alone self-attention layer,并且构建了full attention model,验证了content-based的相互关系能够作为视觉模型特征提取的主要基 ...
随机推荐
- CXAnimation类
#include "XAnimation.h" CXAnimation::CXAnimation(void) { m_strName = ""; m_nFram ...
- makefile之include
"include"指示符告诉 make 暂停读取当前的 Makefile,而转去读取"include"指定的一个或者多个文件,完成以后再继续当前 Makefil ...
- 总结iOS9中的新的方法
iOS平台在快速的发展,各种接口正在不断的更新.随着iOS9的发布,又有一批老方法不推荐使用了,你若调用这些方法,运行的结果是没有问题的,但是会出现警告“***is deprecated :first ...
- NIO--SocketChannel发送HTTP请求
import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.SocketChanne ...
- Mac OS下配置PHP Nginx PHP-FPM
首先需要安装homebrew, 不赘述了 php-fpm php-fpm是mac下自带的软件, 而且兼容不同的PHP版本, 不用额外安装, 但是fpm是需要配置的, 在/private/etc下有个模 ...
- ThreadPool has stuck threads
weblogic 10后台出现警告,原因:ThreadPool has stuck threads 在WEBLOGIC中如果一个线程执行时间超过了Stuck Thread Max Time规定的时间, ...
- linux超级终端minicom的使用方法
===== 一.Minicom介绍 ===== Linux下的Minicom的功能与Windows下的超级终端功能相似,可以通过串口控制外部的硬件 设备.适于在linux通过超级终端对 ...
- UCOS2系统内核讲述(四)_创建任务
Ⅰ.写在前面 学习本文之前可以参看我前面的文章: UCOS2_STM32移植详细过程(汇总文章) UCOS2系统内核讲述(一)_总体描述 UCOS2系统内核讲述(二)_初始化调用函数 UCOS2系统内 ...
- H2 Database 支持数据类型
整数(INT) -2147483648 到 2147483647 java.lang.Integer 布尔型(BOOLEAN) TRUE 和 FALSE java.lang.Boolean 微整数(T ...
- web服务器优化的一些思路
作为一个新手(并不是菜鸟,而是像我们这样的学生),维护一个网站往往是一个很头疼的问题,尤其是动态网站,更尤其是用java写的网站. 当网站的吞吐量很小的时候你会发现服务器根本不需要维护,因为几乎没有延 ...