1
00:00:00,330 --> 00:00:01,040
Hello.

2
00:00:01,140 --> 00:00:02,100
Welcome back.

3
00:00:02,100 --> 00:00:10,170
In this lesson we should talk about convolution convolution is a widely used mathematical operator that

4
00:00:10,170 --> 00:00:17,730
processes an image by computing for each pixel and weighted to some of the values of that pixel and

5
00:00:17,850 --> 00:00:18,770
its neighbors.

6
00:00:18,840 --> 00:00:27,270
As we can see over here dependent on the choice of weights a wide variety of image processing operations

7
00:00:27,330 --> 00:00:35,280
can be implemented convolution and correlation are the two fundamental mathematical operations involved

8
00:00:35,370 --> 00:00:41,350
in lenient neighborhood oriented image processing algorithms.

9
00:00:41,850 --> 00:00:51,120
The convolution between two discrete one dimensional arrays a of X and b of x is denoted US is not be

10
00:00:51,150 --> 00:00:56,880
mathematically mathematically it is described by this equation

11
00:00:59,520 --> 00:01:01,600
right messianic sample.

12
00:01:01,680 --> 00:01:07,740
In this example which will show how the resort of a one D convolution operation can be obtained step

13
00:01:07,740 --> 00:01:08,760
by step.

14
00:01:08,940 --> 00:01:18,830
Let's say we have reached it with the values 0 1 2 3 1 0 and I repeat with it values 1 3 and minus 1.

15
00:01:18,840 --> 00:01:22,350
Let's see how to perform a convolution B.

16
00:01:22,350 --> 00:01:31,650
Initially we narrow our way B and align its center or reference value with the leftmost value of a partial

17
00:01:31,650 --> 00:01:39,630
result of the convolution calculation is 0 times minus one plus zero times three plus one times one.

18
00:01:39,720 --> 00:01:48,600
And this is equal to one as we can see over here 3 which is the center value of our rate B is aligned

19
00:01:48,600 --> 00:01:52,710
with zero which is the left most value of a.

20
00:01:53,340 --> 00:01:58,300
Next we shift a rate B one position to the right.

21
00:01:58,420 --> 00:02:07,410
The partial result of this convolution calculation becomes 0 times minus one plus one times my net plus

22
00:02:07,410 --> 00:02:14,480
one times three as we can see over here plus two times one and this gives us five.

23
00:02:14,850 --> 00:02:22,860
So at this stage of the stage of our calculation the values in the what a convolution B array is going

24
00:02:22,860 --> 00:02:24,090
to be one in 5.

25
00:02:24,690 --> 00:02:24,990
Right.

26
00:02:25,020 --> 00:02:31,650
So this is a is an array inputs everyone P is inputs every 2 we're going to have the third array here

27
00:02:31,740 --> 00:02:32,960
where we start a result.

28
00:02:32,970 --> 00:02:35,880
So this is the current state of that array.

29
00:02:35,880 --> 00:02:43,950
Next we are going to shift b another position to the right and we perform the calculation again the

30
00:02:43,950 --> 00:02:55,080
calculation becomes 1 times minus 1 two times three three times one and then we just add up the we just

31
00:02:55,170 --> 00:03:00,060
add up the product of this this and this and then this is what we get we get 8 and we store that in

32
00:03:00,060 --> 00:03:03,330
a Y resultant array in a what output array.

33
00:03:03,930 --> 00:03:06,060
So we're going to shift again we're going to shift.

34
00:03:06,060 --> 00:03:10,830
I repeat again as you can see we've shifted.

35
00:03:10,830 --> 00:03:18,360
I repeat again we performed the calculation two times minus one plus three times three plus two times

36
00:03:18,360 --> 00:03:18,970
one.

37
00:03:18,990 --> 00:03:21,080
This keeps us nine we stop.

38
00:03:21,150 --> 00:03:27,330
This will give us nine and we're going to store that in a while we're going to store that in a Y resorts

39
00:03:27,420 --> 00:03:36,910
array let's see I've written eight over here two times minus two times minus one gives us minus two.

40
00:03:36,930 --> 00:03:38,330
This would give us nine.

41
00:03:38,460 --> 00:03:39,300
This would give us two.

42
00:03:39,330 --> 00:03:42,690
So this value here should be nine not eight.

43
00:03:42,750 --> 00:03:43,800
So there's a typo here.

44
00:03:43,800 --> 00:03:44,730
Just bear with me.

45
00:03:45,720 --> 00:03:48,430
So next we would shift again.

46
00:03:49,290 --> 00:03:52,640
I repeat is going to be shifted to the right again.

47
00:03:52,800 --> 00:03:58,890
So when we shift it this becomes the position and then we perform the calculation three times minus

48
00:03:58,890 --> 00:04:08,100
one plus two three times three plus one times one and then this will give us this would give us four

49
00:04:08,790 --> 00:04:16,980
and then we store this resort over here in a while outputs array and then we shift again and then we

50
00:04:16,980 --> 00:04:24,490
perform the same computation to minus one this time and then plus one times three.

51
00:04:24,520 --> 00:04:32,810
As you can see over here and then plus several times one and then we store the resort over here in a

52
00:04:32,850 --> 00:04:37,520
while outputs array and then we shift again.

53
00:04:38,010 --> 00:04:44,640
This is the final shift and then we perform the calculation one times minus one which will give us minus

54
00:04:44,640 --> 00:04:51,180
one plus three times three which will give us zero plus two times one which will give us zero so the

55
00:04:51,210 --> 00:04:52,990
output is minus 1.

56
00:04:53,010 --> 00:04:58,410
So this is the end of a war computation.

57
00:04:58,410 --> 00:05:04,290
So at the end of the competition this is the results we'll find in our output array and this is the

58
00:05:04,290 --> 00:05:07,260
results of a convolution B.

59
00:05:07,290 --> 00:05:16,560
Given that the array a contains these these values 0 1 2 3 2 1 0 and then I repeat contains these values

60
00:05:16,590 --> 00:05:18,560
minus 1 3 and 1.

61
00:05:18,570 --> 00:05:21,090
This over here should be number 9.

62
00:05:21,090 --> 00:05:24,430
We detected this type earlier on so right.

63
00:05:24,450 --> 00:05:27,510
This is how easy it is to perform convolution.

64
00:05:27,510 --> 00:05:36,250
What I'm going to do is I'm going to attach the code to perform convolution from some of my other courses.

65
00:05:36,270 --> 00:05:43,390
I have image processing causes that shows how to develop convolution of rhythms for images.

66
00:05:43,410 --> 00:05:46,110
So I'm going to take some of those videos and put it here.

67
00:05:46,110 --> 00:05:51,020
For those of you who are interested in seeing how it is done you can take a look at that.

68
00:05:51,030 --> 00:05:54,380
But it's not required for what we are doing in this new course.

69
00:05:54,450 --> 00:05:56,750
And I'm going to touch the quote as well.

70
00:05:56,760 --> 00:05:57,090
Right.

71
00:05:57,120 --> 00:05:58,510
So that's all there is.

72
00:05:58,710 --> 00:06:00,510
And then I'll see you in the next lesson.
