Time for action - smoothing an image
Let's work out an example where a smoothing filter will be applied to an image.
- Download the image file
0165_3_Before_SMOOTHING.png from the Packt website and save it as
- This is a low-resolution image scanned from a developed photograph. As you can see, there is a lot of salt-and-pepper noise in the image. We will apply smoothing filter to reduce some of this noise in the image data.
- Add the following code in a Python file.
img = Image.open( "C:\\images\\Before_SMOOTH.png ")
img = img.filter(ImageFilter.SMOOTH)
- The highlighted line in the code is where the smoothing filter is applied to the image. The ...