ImageVerifierCode 换一换
格式:DOCX , 页数:15 ,大小:228.75KB ,
资源ID:9695682      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/9695682.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Convolution.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

Convolution.docx

1、ConvolutionConvolutionConvolution is the most important and fundamental concept in signal processing and analysis. By using convolution, we can construct the output of system for any arbitrary input signal, if we know the impulse response of system.How is it possible that knowing only impulse respon

2、se of system can determine the output for any given input signal? We will find out the meaning of convolution.Related Topics:Window FiltersDownload:conv1d.zip,conv2d.zip Definition Impulse Function Decomposition Impulse Response Back to the Definition Convolution in 1D C+ Implementation for Convolut

3、ion 1D Convolution in 2D Separable Convolution 2D C+ Algorithm for Convolution 2DDefinitionFirst, lets see the mathematical definition of convolution in discrete time domain. Later we will walk through what this equation tells us.(We will discuss in discrete time domain only.)wherexnis input signal,

4、hnis impulse response, andynis output. * denotes convolution. Notice that we multiply the terms ofxkby the terms of a time-shiftedhnand add them up.The keystone of understanding convolution is laid behind impulse response and impulse decomposition.Impulse Function DecompositionIn order to understand

5、 the meaning of convolution, we are going to start from the concept of signal decomposition. The input signal is decomposed into simple additive components, and the system response of the input signal results in by adding the output of these components passed through the system.In general, a signal

6、can be decomposed as a weighted sum of basis signals. For example, in Fourier Series, any periodic signal (even rectangular pulse signal) can be represented by a sum of sine and cosine functions. But here, we use impulse (delta) functions for the basis signals, instead of sine and cosine.Examine the

7、 following example how a signal is decomposed into a set of impulse (delta) functions. Since the impulse function,nis 1 atn=0, and zeros atn 0.x0can be written to2n. And,x1will be3n-1, becausen-1is 1 atn=1and zeros at others. In same way, we can writex2by shiftingnby 2,x2=1n-2. Therefore, the signal

8、,xncan be represented by adding 3 shifted and scaled impulse functions.In general, a signal can be written as sum of scaled and shifted delta functions;Impulse ResponseImpulse response is the output of a system resulting from an impulse function as input.And it is denoted ashn.If the system istime-i

9、nvariant, the response of a time-shifted impulse function is also shifted as same amount of time.For example, the impulse response ofn-1ishn-1. If we know the impulse responsehn, then we can immediately get the impulse responsehn-1by shiftinghnby +1. Consequently,hn-2results from shiftinghnby +2.If

10、the system islinear(especially scalar rule), a scaled in input signal causes an identical scaling in the output signal.For instance, the impulse response of3nis just multiplying by 3 tohn.If the input has 3 components, for example,an +bn-1 +cn-2, then the output is simplyahn +bhn-1 +chn-2. This is c

11、alled additive property oflinearsystem, thus, it is valid only on thelinearsystem.Back to the DefinitionBy combining the properties of impulse response and impulse decomposition, we can finally construct the equation of convolution. Inlinearandtime-invariant system, the response resulting from sever

12、al inputs can be computed as the sum of the responses each input acting alone.For example, if input signal isxn = 2n + 3n-1 + 1n-2, then the output is simplyyn = 2hn + 3hn-1 + 1hn-2.Therefore, we now clearly see that if the input signal is, then the output will be. Note one condition; convolution wo

13、rks on thelinearandtime invariant system.To summarize, a signal is decomposed into a set of impulses and the output signal can be computed by adding the scaled and shifted impulse responses.Furthermore, there is an important fact under convolution; the only thing we need to know about the systems ch

14、aracteristics is the impulse response of the system,hn. If we know a systems impulse response, then we can easily find out how the system reacts for any input signal.Convolution in 1DLets start with an example of convolution of 1 dimensional signal, then find out how to implement into computer progr

15、amming algorithm.xn = 3, 4, 5 hn = 2, 1 xnhas only non-zero values atn=0,1,2,and impulse response,hnis not zero atn=0,1. Others which are not listed are all zeros.Input:xnImpulse Response:hnOne thing to note before we move on: Try to figure out yourself how this system behaves, by only looking at th

16、e impulse response of the system. When the impulse signal is entered the system, the output of the system looks like amplifier and echoing. At the time is 0, the intensity was increased (amplified) by double and gradually decreased while the time is passed.From the equation of convolution, the outpu

17、t signalynwill be.Lets compute manually each value ofy0,y1,y2,y3,.Output:ynNotice thaty0has only one component,x0h0, and others are omitted, because others are all zeros atk 0. In other words,x1h-1 =x2h-2 = 0. The above equations also omit the terms if they are obviously zeros.Ifnis larger than and

18、equal to 4,ynwill be zeros. So we stop here to computeynand adding these 4 signals (y0,y1,y2,y3) produces the output signalyn = 6, 11, 14, 5.Lets look more closely the each output. In order to see a pattern clearly, the order of addition is swapped. The last term comes first and the first term goes

19、to the last. And, all zero terms are ignored.y0 =x0h0y1 =x1h0 +x0h1y2 =x2h0 +x1h1y3 =x3h0 +x2h1Can you see the pattern? For example,y2is calculated from 2 input samples;x2andx1, and 2 impulse response samples;h0andh1. The input sample starts from 2, which is same as the sample point of output, and d

20、ecreased. The impulse response sample starts from 0 and increased.Based on the pattern that we found, we can write an equation for any sample of the output;whereiis any sample point and k is the number of samples in impulse response.For instance, if an impulse response has 4 samples, the sample of o

21、utput signal at 9 is;y9 =x9h0 +x8h1 +x7h2 +x6h3Notice the first sample,y0has only one term. Based on the pattern that we found,y0is calculated as:y0 =x0h0 +x-1h1. Becausex-1is not defined, we simply pad it to zero.C+ Implementation for Convolution 1DImplementing the convolution algorithm is quite si

22、mple. The code snippet is following;for ( i = 0; i sampleCount; i+ ) yi = 0; / set to zero before sum for ( j = 0; j kernelCount; j+ ) yi += xi - j * hj; / convolve: multiply and accumulate However, you should concern several things in the implementation.Watch out the range of input signal. You may

23、be out of bound of input signal, for example, x-1, x-2, and so on. You can pad zeros for those undefined samples, or simply skip the convolution at the boundary. The results at the both the beginning and end edges cannot be accurate anyway.Second, you need rounding the output values, if the output d

24、ata type is integer and impulse response is floating point number. And, the output value may be exceeded the maximum or minimum value.If you have unsigned 8-bit integer data type for output signal, the range of output should be between 0 and 255. You must check the value is greater than the minimum

25、and less than the maximum value.Download the 1D convolution routine and test program.conv1d.zipConvolution in 2D2D convolution is just extension of previous 1D convolution by convolving both horizontal and vertical directions in 2 dimensional spatial domain. Convolution is frequently used for image

26、processing, such as smoothing, sharpening, and edge detection of images.The impulse (delta) function is also in 2D space, som, nhas 1 wheremandnis zero and zeros atm,n 0. The impulse response in 2D is usually called kernel or filter in image processing.The second image is 2D matrix representation of

27、 impulse function. The shaded center point is the origin wherem=n=0.Once again, a signal can be decomposed into a sum of scaled and shifted impulse (delta) functions;For example,x0, 0isx0, 0m, n,x1, 2isx1, 2m-1, n-2, and so on. Note that the matrices are referenced here as column, row, not row, colu

28、mn. M is horizontal (column) direction and N is vertical (row) direction.And, the output oflinearandtime invariant systemcan be written by convolution of input signalxm, n, and impulse response,hm, n;Notice that the kernel (impulse response) in 2D is center originated in most cases, which means the

29、center point of a kernel ish0, 0. For example, if the kernel size is 5, then the array index of 5 elements will be -2, -1, 0, 1, and 2. The origin is located at the middle of kernel.Examine an example to clarify how to convolve in 2D space.Lets say that the size of impulse response (kernel) is 3x3,

30、and its values are a, b, c, d,.Notice the origin (0,0) is located in the center of kernel.Lets pick a simplest sample and compute convolution, for instance, the output at (1, 1) will be;It results in sum of 9 elements of scaled and shifted impulse responses. The following image shows the graphical representation of 2D convolution.2D ConvolutionNotice that the kernel matrix is flipped both horizontal and vertical direction be

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1