Image Blurring

Introduction

In the previous tutorial, we have seen the image thresholding by various techniques. In this tutorial, the complete discussion is on the most common process of image blurring and smoothing in image processing to read the image data effectively.

The smoothing of the images will reduce the noise level on the image and make the image to be clear. There are many methods used for blurring and smoothing of the images. Few methods are used for effective edge detection. This algorithm of edge detection will detect many edges if the image is clear without any blur effect.

There are different methods that can be applied to the image for effective image blurring, smoothing, sharpening, etc.

Different Methods

Gamma Correction

This method of Gamma correction will be useful to adjust the brightness level and the darkness level of the image by setting the different Gamma values accordingly.

Kernel-Based Filters

The kernel is the set of values in the form of a matrix, These values can be multiplied to all the pixel values and form a new image with the resultant pixel values. The kernel-based filters offer a wide range of effects on the images and use for interactive visualization.

Implementation

Now, let us implement the different filters and effects by using the Jupyter notebook.

Let us import the required libraries to implement the different methods on the images.

Now, to use the loading of image code for multiple set of times, let us define it as function.

Similarly, let us define another function to display the image.

The image can be read and displayed on to the screen, by using the above described functions.

The Gamma value can be set for adjusting the level of brightness of the image. Let us set the value as ½.

Now the output image looks in this way.

In this operation, by setting the different values of Gamma, the brightness level of the image can be adjusted. Gamma value less than 1, will make the images to look dimmer and the value higher than 1, will increase the level of the brightness.

Now, write on to the image using the respective font size as discussed in the previous tutorial.

Now, when the image is displayed, it looks in a similar way.

Then, you need to create a kernel and store with the respective values, to apply the filter on to it.

Now, you can apply the 2d filter to the image, and get a clear image with the better smoothing of the text by blurring the background image.

There are few other image blurring functions, supported by open cv. Let us apply the cv.blur to the image for a clear view.

Now, let us apply the gaussian blur function for effective smoothing of the image compared to the above one.

There is one more function of median blur supported by open cv to have the better image view.

This function shows the image along with the text in a better way, without any background blur. This way, the reduction of blurring in the images will be useful for better edge detection operations in OpenCV.

This is all the end of this tutorial about the image blurring and smoothing using the Open CV operations. For any sort of doubts or the questions in this tutorial, you can reach out through the comment box.

Related Tutorials

Thresholding

Blending Images

Spread knowledge

Leave a Comment

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