The Wayback Machine - https://web.archive.org/web/20240816161228/https://www.geeksforgeeks.org/what-is-image-blurring/
Open In App

What is Image Blurring

Last Updated : 14 Oct, 2018
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

What is convolution in 2D?
Image is denoted as matrix inside computer. An image contains a lot of features like edge, contrast etc. In image processing features have to be extracted from the image for further study of image.
Convolution is a fundamental operation on images in which a mathematical operation is applied to each pixel to get the desired result.
For this purpose, another matrix called as kernel is used which is smaller in size of image. This is also called filter. This filter is applied on each pixel of the image and new value obtained is the value of that pixel. The image obtained is called filtered image.
In kernel each cell contain some value, that kernel is kept above the pixel and corresponding values are multiplied and then summed up this value obtained is new the value of pixel.

What is Blurring
If a blurred image is observed carefully then a common thing to notice is that image is smooth meaning edges are not observed. A filter used for blurring is also called low pass filter, because it allows low frequency to enter and stop high frequency. Here frequency means the change of pixel value. Around edge pixel value changes rapidly as blur image is smooth so high frequency should be filtered out.
For blur purpose a filter with every call having value 1 is used because to blur image a pixel value should be close to neighbor value.
In filter it is divided by 9 for normalization otherwise value of a pixel will increase resulting in more contrast which is not the goal.

We can choose the size of the kernel depending on how much we want to smoothen the image. Choosing a bigger size will be averaging over a larger area. This tends to increase the smoothening effect.




# Write Python3 code here
  
import cv2
import numpy as np
  
image = cv2.imread('geek.jpg')
  
# making filter of 3 by 3 filled with 1 divide 
# by 9 for normalization
blur_filter1 = np.ones((3, 3), np.float)/(9.0)
  
# making filter of 5 by 5 filled with 1 divide
# by 25 for normalization
blur_filter2 = np.ones((5, 5), np.float)/(25.0)
  
# making filter of 7 by 7 filled with 1 divide 
# by 49 for normalization
blur_filter3 = np.ones((7, 7), np.float)/(49.0)
  
image_blur1 = cv2.filter2D(image, -1, blur_filter1)
image_blur2 = cv2.filter2D(image, -1, blur_filter2)
image_blur3 = cv2.filter2D(image, -1, blur_filter3)
  
cv2.imshow('geek', image)
cv2.imshow('geek_blur1', image_blur1)
cv2.imshow('geek_blur2', image_blur2)
cv2.imshow('geek_blur3', image_blur3)
  
cv2.waitKey(0)
cv2.destroyAllWindows()


Output

Original image


Blurred with filter of 3 x 3


Blurred with filter of 5 x 5


Blurred with filter of 7 x 7

With large filter the images smoothed more.



Similar Reads

Python | Image blurring using OpenCV
Image Blurring refers to making the image less clear or distinct. It is done with the help of various low pass filter kernels. Advantages of blurring: It helps in Noise removal. As noise is considered as high pass signal so by the application of low pass filter kernel we restrict noise. It helps in smoothing the image. Low intensity edges are remov
2 min read
Image Processing in Java - Colored Image to Grayscale Image Conversion
Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and set PixelsIn this article, we will be converting a colored image to a grayscale image. RGB Color Model - The RGB color model is an additive mixing model in which red, green, and blue light are added together in various ways to reproduce a broad array of color
3 min read
Image Processing in Java - Colored image to Negative Image Conversion
Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored image to Grayscale Image Conversion In this set, we will be converting a colored image to a negative image. Colored Image (RGB Color Model) - The RGB color model is an additive mixing model in which red, green, and
3 min read
Image Processing in Java - Colored Image to Sepia Image Conversion
Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored Image to Grayscale Image ConversionImage Processing in Java - Colored Image to Negative Image ConversionImage Processing in Java - Colored to Red Green Blue Image Conversion In this set, we will be converting a col
3 min read
Mahotas - Labelled Image from the Normal Image
In this article we will see how we can create a labelled image from the normal image in mahotas. For this we are going to use the fluorescent microscopy image from a nuclear segmentation benchmark. We can get the image with the help of command given below mahotas.demos.nuclear_image() Below is the nuclear_image Labelled images are integer images wh
2 min read
Image processing with Scikit-image in Python
scikit-image is an image processing Python package that works with NumPy arrays which is a collection of algorithms for image processing. Let's discuss how to deal with images in set of information and its application in the real world. Important features of scikit-image : Simple and efficient tools for image processing and computer vision techniqu
2 min read
MATLAB | RGB image to grayscale image conversion
An RGB image can be viewed as three images( a red scale image, a green scale image and a blue scale image) stacked on top of each other. In MATLAB, an RGB image is basically a M*N*3 array of colour pixel, where each colour pixel is a triplet which corresponds to red, blue and green colour component of RGB image at a specified spatial location. Simi
4 min read
MATLAB | Converting a Grayscale Image to Binary Image using Thresholding
Thresholding is the simplest method of image segmentation and the most common way to convert a grayscale image to a binary image.In thresholding, we select a threshold value and then all the gray level value which is below the selected threshold value is classified as 0(black i.e background ) and all the gray level which is equal to or greater than
3 min read
Image Edge Detection Operators in Digital Image Processing
Edges are significant local changes of intensity in a digital image. An edge can be defined as a set of connected pixels that forms a boundary between two disjoint regions. There are three types of edges: Horizontal edgesVertical edgesDiagonal edges Edge Detection is a method of segmenting an image into regions of discontinuity. It is a widely used
4 min read
How to Convert PIL Image into pygame surface image?
In this article, we will know How to Convert PIL Image into pygame surface image. Pygame Surface Image: A surface that not only has fixed resolution and pixel format but also represents the image in Pygame is known as Pygame Surface Image. Are you constructing any game in Pygame in which you want to use only Pygame Surface Image as an input? As mos
4 min read
Convert Text Image to Hand Written Text Image using Python
In this article, we are going to see how to convert text images to handwritten text images using PyWhatkit, Pillow, and Tesseract in Python. Module needed: Pytesseract: Sometimes known as Python-tesseract, is a Python-based optical character recognition (OCR) program. It can read and recognize text in photos, license plates, and other documents. To
2 min read
Image Segmentation using Python's scikit-image module
The process of splitting images into multiple layers, represented by a smart, pixel-wise mask is known as Image Segmentation. It involves merging, blocking, and separating an image from its integration level. Splitting a picture into a collection of Image Objects with comparable properties is the first stage in image processing. Scikit-Image is the
14 min read
Image Processing in Java - Colored to Red Green Blue Image Conversion
Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored Image to Grayscale Image ConversionImage Processing in Java - Colored Image to Negative Image Conversion In this set, we will be converting a colored image to an image with either red effect, green effect, or blue
5 min read
Image Processing in Java - Creating a Random Pixel Image
Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored Image to Grayscale Image ConversionImage Processing in Java - Colored Image to Negative Image ConversionImage Processing in Java - Colored to Red Green Blue Image ConversionImage Processing in Java - Colored Image
2 min read
Image Processing in Java - Creating a Mirror Image
Prerequisite: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored Image to Grayscale Image ConversionImage Processing in Java - Colored Image to Negative Image ConversionImage Processing in Java - Colored to Red Green Blue Image ConversionImage Processing in Java - Colored Image t
3 min read
Image Processing in Java - Watermarking an Image
Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored Image to Grayscale Image ConversionImage Processing in Java - Colored Image to Negative Image ConversionImage Processing in Java - Colored to Red Green Blue Image ConversionImage Processing in Java - Colored Image
3 min read
Image Processing in Java - Changing Orientation of Image
Prerequisites: Image Processing in Java - Read and WriteImage Processing In Java - Get and Set PixelsImage Processing in Java - Colored Image to Grayscale Image ConversionImage Processing in Java - Colored Image to Negative Image ConversionImage Processing in Java - Colored to Red Green Blue Image ConversionImage Processing in Java - Colored Image
3 min read
Project Idea | (Model based Image Compression of Medical Images)
The project is about providing fast transfer of medical images to/from rural areas where bandwidth is low. The idea is to keep model medical images at all locations (rural and urban). To transfer a patient's image from one location to another, find the difference image from patients image to model image. The difference image would have less data to
1 min read
Project Idea | ( Character Recognition from Image )
Aim : The aim of this project is to develop such a tool which takes an Image as input and extract characters (alphabets, digits, symbols) from it. The Image can be of handwritten document or Printed document. It can be used as a form of data entry from printed records. Tool : This project is based on Machine learning, We can provide a lot of data s
2 min read
OpenCV C++ Program to create a single colored blank image
The following is the explanation to the C++ code to create a single colored blank image in C++ using the tool OpenCV. Things to know:  (1) The code will only compile in Linux environment. (2) To run in windows, please use the file: 'blank.o' and run it in cmd. However if it does not run (problem in system architecture) then compile it in windows by
3 min read
OpenCV C++ Program to blur an image
The following is the explanation to the C++ code to blur an Image in C++ using the tool OpenCV. Things to know: (1) The code will only compile in Linux environment. (2) Compile command: g++ -w article.cpp -o article `pkg-config --libs opencv` (3) Run command: ./article (4) The image bat.jpg has to be in the same directory as the code. Before you ru
5 min read
OpenCV Python Program to blur an image
Note: This post contains codes that cannot be run using an online compiler. Please make sure that you have Python 2.7 and cv2 module installed before trying to run the program on your system. Hi everyone! I read a brilliant work by Aditya Prakash – OpenCV C++ Program to blur an image, so I decided to come up with something similar but this time in
2 min read
Google Chrome Dino Bot using Image Recognition | Python
What would you see in your Chrome browser when there is no internet connection? Yes, everybody knows that dinosaur game that comes on screen. So, in this article, we are going to build a simple python bot that plays Chrome Dino Game without user interaction. Here we are not using any machine learning or artificial intelligence to counter this probl
4 min read
Mahotas - Getting Mean Value of Image
In this article we will see how we can get the mean value of image in mahotas. Mean value is the sum of pixel values divided by the total number of pixel values. Pixel Values Each of the pixels that represents an image stored inside a computer has a pixel value which describes how bright that pixel is, and/or what color it should be. In the simples
2 min read
Image segmentation using Morphological operations in Python
If we want to extract or define something from the rest of the image, eg. detecting an object from a background, we can break the image up into segments in which we can do more processing on. This is typically called Segmentation. Morphological operations are some simple operations based on the image shape. It is normally performed on binary images
3 min read
Digital Image Processing Basics
Digital Image Processing means processing digital image by means of a digital computer. We can also say that it is a use of computer algorithms, in order to get enhanced image either to extract some useful information. Digital image processing is the use of algorithms and mathematical models to process and analyze digital images. The goal of digita
7 min read
Image based Steganography using Python
Steganography is the method of hiding secret data in any image/audio/video. In a nutshell, the main motive of steganography is to hide the intended information within any image/audio/video that doesn’t appear to be secret just by looking at it.The idea behind image-based Steganography is very simple. Images are composed of digital data (pixels), wh
5 min read
Python | Get a google map image of specified location using Google Static Maps API
Google Static Maps API lets embed a Google Maps image on the web page without requiring JavaScript or any dynamic page loading. The Google Static Maps API service creates the map based on URL parameters sent through a standard HTTP request and returns the map as an image one can display on the web page. To use this service, one must need an API key
2 min read
Python | Visualizing image in different color spaces
OpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on pictures or videos. It was originally developed by Intel but was later maintained by Willow Garage and is now maintained by Itseez. This library is cross-platform that is it is available on multiple programming languages such a
4 min read
Image Processing in MATLAB | Fundamental Operations
1. Reading Images Images are read into the MATLAB Environment using imread() function which takes filename with applicable extension as the argument For Example: >> I=imread('nature.jpg'); This will read JPEG image 'nature' into the image array. Note: The semicolon(;) at the end of command line is used to suppress the output in MATLAB.If ';'
3 min read
three90RightbarBannerImg