Smoothing Process Over an Image Using Average

So now let’s look at a 2-D example of this. Here I’ve basically shown you a nine by nine, image just as a sample. And we will actually work around with this. And note that basically I’ve filled it in with a lot of zeroes and 90s and just to keep the, approach simple. And these are intentionally designed to be values that we can actually do some simple math with. What we want to do now is smooth some aspects of this, to be able to generate a newer, smoother image. Here is the new image that I want to start filing in the values for. Notice again that in this image, I’ve actually given values of 90s. So you can imagine them to be the most, the peak value, of the image. And again I’ve left us some holes with the zero here, black point, and also 90 here to kind of give it some diversity, and see how that actually generates itself. To help us do this, let’s actually look at a three by three neighborhood. So while this image is nine-by-nine, I want to actually use a three-by-three neighborhood to be able to then, smooth out and an intense, basically the intention is, that every time I apply this three-by-three neighborhood, I want to generate a new value, at this point, and place it here. Okay? That’s the goal. So of course by looking at this, you can start guessing that if I was to do a simple linear average, that is take the sum of all of this and divide by nine, I would be able to come up with a value that I could place in here. And that value of course would be zero. Let’s keep moving, and now I actually, next time what I’ll do is, I want to move this one frame here because we want to actually raster scan and move this all over this image to be able to generate newer versions of the output image. Now doing the summation over all of this neighborhood here, you would basically see the summation is simply ninety, and of course I have nine divided by nine, nine elements so you can predict what the next value is going to be, ten. And we can keep doing this one after the other, moving to the next one, one eighty is the sum divided that by. nine, twenty and you can see basically, how we can start filling up all of the values of this output matrix. Once I’m done with this part here, of course I’ve filled in the ten and now I need to rotate around, and start looking at these values here. Move here. Zero again. Three values of ninety, so 270 divided by nine. And using this, I can get all the way to the end here and, fill in all of the values that came out of this process. Now one thing you may notice that because the way we looked at our neighborhood of three by three, and we’re replacing the value here which is value here, this whole top row, and the two edged columns, and the bottom row are, of course, not filled. We’ll discuss how to fill that up in a, in a bit. So while this thing is filled up, let’s now start looking at what really happened and what we can learn from this. So a couple of interesting things happen. There was a zero here. If you noticed, the zero is now in this image, replaced by a much higher value. Because again, if you notice it in both direction. This pixel would have been of this intensity has been smoothed out. Similarly there was a 90 here and it’s been reduced to 10. And again you may argue that actually the whole image now is much smoother than this thinks. Now of course there were two reasons we could have done this one. Maybe this was some sort of an error. Or maybe we just want to blur some information out. And again both we will look at in careful detail. Blurring or removing noise and error. To help visualize this let me actually show this with a little bit of information that’s not just numbers, but shades of gray. To achieve this, what I’m doing now is creating the same image, except now I’m giving white values to all 90. Assume this to be 255 equivalent scale between zero and 90. And all of the blacks are, of course, still zero. So this is my original image. And now what I do is basically run the same process and see what the output looks like. So this would be what the output would look like for that image. Again, smoothed out by an average filter that’s a three-by-three rubbed over the whole image. And if you notice again, most of the 90s persist here because that’s where majority of the information was much more in the neighborhood the same. And the rest of it now is kind of a simple smooth ramp, as opposed in this one where it goes to 90 to zero and 90 to zero here. All that kind of jagginess has been removed.

Posts created 3637

8 thoughts on “Smoothing Process Over an Image Using Average

  1. Thank you your video really help to understand box filter for me. I just wondering you divide onΒ nine each 3 by 3 neighborhood of average. if the filter were 4 by4 , divied on sixteen?

Leave a Reply

Your email address will not be published. Required fields are marked *

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top