1 / 32

Visualization in Medicine Lecture: Convolution

Visualization in Medicine Lecture: Convolution. Overview. Function Signal Impulse Function Impulse Function Decomposition Impulse Response Convolution Convolution 1D Implementing 1D Convolution Convolution 2D Implementing 2D Convolution Image Filter. Function. Source: Wikipedia.

tanith
Download Presentation

Visualization in Medicine Lecture: Convolution

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visualization in Medicine Lecture: Convolution

  2. Overview • Function • Signal • Impulse Function • Impulse Function Decomposition • Impulse Response • Convolution • Convolution 1D • Implementing 1D Convolution • Convolution 2D • Implementing 2D Convolution • Image Filter University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 2

  3. Function Source: Wikipedia A function is a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output. A function f takes an input x, and returns an output f(x) University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 3

  4. Signal Discrete-time signal created from a continuous signal by sampling Signal: A function that conveys information about the behaviour or attributes of some phenomenon. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 4

  5. Impulse Function (δ function) The Impulse function (δ function) is a generalized function that is zero everywhere except at zero. The impulse function, δ[n] is 1 at n=0, and zeros at n ≠ 0. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 5

  6. Impulse Function Decomposition A signal can be decomposed as a weighted sum of impulse function 3 3 2 2 2 1 1 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 1 Weighted sum of impulse functions 0 1 2 3 0 1 2 3

  7. Impulse Function Decomposition A signal can be decomposed as a weighted sum of impulse function The signal, x[n] can be represented by adding the shifted and scaled impulse functions University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 7

  8. Impulse Function Decomposition In general, a signal can be written as sum of scaled and shifted delta functions. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 8

  9. Impulse Response System= any signal * impulse function * = System System 2 2 1 2 1 1 0 1 2 3 0 1 2 3 0 1 2 3 University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 9 Impulse response is the output of a system resulting from an impulse function as input. Impulse response is denoted as h[n].  Impulse response of time shifted impulse function

  10. Impulse Response: Scaling factor System If the system is linear, a scaled in input signal causes an identical scaling in the output signal. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 10

  11. Additive Property of Impulse Response System If the input has 3 components then the output is simply This is called additive property of linear system. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 11

  12. Additive Property of Impulse Response System The response resulting from several inputs can be computed as the sum of the responses each input acting alone.  University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 12

  13. Additive Property of Impulse Response (cont) We see that if the input signal is then the output will be 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. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 13

  14. Convolution University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 14

  15. Convolution Convolution 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.  University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 15

  16. Convolution General concept of convolution: A signal is decomposed into a set of impulses and the output signal can be computed by adding the scaled and shifted impulse responses University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 16

  17. Convolution: An Important Fact The only thing we need to know about the system's characteristics is the impulse response of the system, h[n]. If we know a system's impulse response, then we can easily find out how the system reacts for any input signal. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 17

  18. Convolution The mathematical definition of convolution x[n] is input signal h[n] is impulse response y[n] is output * denotes convolution Notice: The terms of x[k] are multiplied by the terms of a time-shifted h[n] and add them up  University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 18

  19. Convolution in 1D x[n] = { 3, 4, 5 }  h[n] = { 2, 1 } Example of convolution for 1 dimensional signal. x[n] = { 3, 4, 5 } h[n] = { 2, 1 } x[n] has only non-zero values at n=0,1,2, and impulse response, h[n] is not zero at n=0,1. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 19

  20. Convolution in 1D Wikipedia University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 20

  21. h[n] = { 2, 1 } x[n] = { 3, 4, 5 }  Inverse of h[n] 5 5 2 4 4 2 2 3 3 1 1 1 0 1 0 1 0 1 2 0 1 2 University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 21

  22. Next time 2D Convolution University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 22

  23. y[0] = x[0]·h[0] y[1] = x[1]·h[0] + x[0]·h[1] y[2] = x[2]·h[0] + x[1]·h[1] y[3] = x[3]·h[0] + x[2]·h[1] University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 23 Let's 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 to the last. And, all zero terms are ignored.

  24. developer.apple.com University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 24

  25. Sources University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 25 http://www.songho.ca/dsp/convolution/convolution.html

  26. Impulse Function Decomposition 3 3 2 2 2 1 1 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 1 0 1 2 3 0 1 2 3 University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 26

  27. Impulse Function Decomposition A signal can be decomposed as a weighted sum of impulse function Example University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 27

  28. 5 5 5 5 5 5 2 4 4 4 4 4 4 2 2 2 2 2 2 3 3 3 3 3 3 1 1 1 1 1 1 1 0 1 0 1 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 6 11 14 5 0 University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 28

  29. 5 5 2 4 4 2 2 3 3 1 1 1 0 1 0 1 0 1 2 0 1 2 University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 29

  30. Convolution in 1D One thing to note before we move on: Try to figure out yourself how this system behaves, by only looking at the 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 output signal y[n] will be .  Let's compute manually each value of y[0], y[1], y[2], y[3], ... University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 30

  31. Convolution in 1D University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 31

  32. Notice that y[0] has only one component, x[0]h[0], and others are omitted, because others are all zeros at k ≠ 0. In other words, x[1]h[-1] = x[2]h[-2] = 0. The above equations also omit the terms if they are obviously zeros. If n is larger than and equal to 4, y[n] will be zeros. So we stop here to compute y[n]and adding these 4 signals (y[0], y[1], y[2], y[3]) produces the output signal y[n] = {6, 11, 14, 5}. University Of Malakand | Department of Computer Science | Visual Computing Research Group | Dr. Engr.Sami ur Rahman | 32

More Related