Hello.
Welcome back.
In this lesson we should talk about convolution convolution is a widely used mathematical operator that
processes an image by computing for each pixel and weighted to some of the values of that pixel and
its neighbors.
As we can see over here dependent on the choice of weights a wide variety of image processing operations
can be implemented convolution and correlation are the two fundamental mathematical operations involved
in lenient neighborhood oriented image processing algorithms.
The convolution between two discrete one dimensional arrays a of X and b of x is denoted US is not be
mathematically mathematically it is described by this equation
right messianic sample.
In this example which will show how the resort of a one D convolution operation can be obtained step
by step.
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.
Let's see how to perform a convolution B.
Initially we narrow our way B and align its center or reference value with the leftmost value of a partial
result of the convolution calculation is 0 times minus one plus zero times three plus one times one.
And this is equal to one as we can see over here 3 which is the center value of our rate B is aligned
with zero which is the left most value of a.
Next we shift a rate B one position to the right.
The partial result of this convolution calculation becomes 0 times minus one plus one times my net plus
one times three as we can see over here plus two times one and this gives us five.
So at this stage of the stage of our calculation the values in the what a convolution B array is going
to be one in 5.
Right.
So this is a is an array inputs everyone P is inputs every 2 we're going to have the third array here
where we start a result.
So this is the current state of that array.
Next we are going to shift b another position to the right and we perform the calculation again the
calculation becomes 1 times minus 1 two times three three times one and then we just add up the we just
add up the product of this this and this and then this is what we get we get 8 and we store that in
a Y resultant array in a what output array.
So we're going to shift again we're going to shift.
I repeat again as you can see we've shifted.
I repeat again we performed the calculation two times minus one plus three times three plus two times
one.
This keeps us nine we stop.
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
array let's see I've written eight over here two times minus two times minus one gives us minus two.
This would give us nine.
This would give us two.
So this value here should be nine not eight.
So there's a typo here.
Just bear with me.
So next we would shift again.
I repeat is going to be shifted to the right again.
So when we shift it this becomes the position and then we perform the calculation three times minus
one plus two three times three plus one times one and then this will give us this would give us four
and then we store this resort over here in a while outputs array and then we shift again and then we
perform the same computation to minus one this time and then plus one times three.
As you can see over here and then plus several times one and then we store the resort over here in a
while outputs array and then we shift again.
This is the final shift and then we perform the calculation one times minus one which will give us minus
one plus three times three which will give us zero plus two times one which will give us zero so the
output is minus 1.
So this is the end of a war computation.
So at the end of the competition this is the results we'll find in our output array and this is the
results of a convolution B.
Given that the array a contains these these values 0 1 2 3 2 1 0 and then I repeat contains these values
minus 1 3 and 1.
This over here should be number 9.
We detected this type earlier on so right.
This is how easy it is to perform convolution.
What I'm going to do is I'm going to attach the code to perform convolution from some of my other courses.
I have image processing causes that shows how to develop convolution of rhythms for images.
So I'm going to take some of those videos and put it here.
For those of you who are interested in seeing how it is done you can take a look at that.
But it's not required for what we are doing in this new course.
And I'm going to touch the quote as well.
Right.
So that's all there is.
And then I'll see you in the next lesson.