A Demonstration of Filters in Image Processing

Photo by Jacob Owens on Unsplash

Images are Numpy arrays

Figure 1. Randomly Generated Numpy Array
Figure 2. Image of Generated Numpy Array
Figure 3. Sliced Portion after being replaced with zero
Figure 4. Sliced Portion after being replaced with 255

As it has been illustrated above, images are simply Numpy arrays and can be manipulated like any other array.

Filters are operations performed on images.

Kernels

Figure 5. Examples of Kernels

Convolution

Figure 6. Convolution Operation
Figure 7. Mathematical Formular for Convolution
Figure 8. Image & Kernel Matrices
Figure 9. Convolution Computation
Figure 10. Convolution Computation
Figure 11. Output Matrix from Scipy’s Convolution Function

Next, we will observe the various effects different filters/kernels produce.

Mean Kernel

Figure 12. Blurring Effect of the Mean Kernel
Figure 13. Mean and Gaussian Kernel Effects

Identity Kernel

Figure 14.Identity Kernel Effect

Edge-detection Kernel

Figure 15. Edge-detection Kernel Effect

Sharpen Kernel

Figure 16. Sharpen Kernel Effect

Gaussian Kernel

Figure 17. Gaussian Kernel Effect
Figure 18. Tweaked Identity Kernel Effect

References

Data Science enthusiast - Interest in image processing