OpenCV - Blur image Last Updated : 06 Dec, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will learn how to Blur an image using Python OpenCV. Python </p><pre><code class="language-python3"># Python Program to blur image import cv2 # bat.jpg is the batman image. img = cv2.imread('bat.jpg') # make sure that you have saved it in the same folder # You can change the kernel size as you want blurImg = cv2.blur(img,(10,10)) cv2.imshow('blurred image',blurImg) cv2.waitKey(0) cv2.destroyAllWindows()</code></pre><p></p><p><span> </span></p><p dir="ltr"><span> Output: </span></p><img src="https://media.geeksforgeeks.org/wp-content/cdn-uploads/20201127104358/577.png" width="622" height="651"><p style="text-align: justify;" dir="ltr"><span>Now, this program above is using image blurring technique called </span><b><strong>Averaging.</strong></b><span>There are some other options available as well – </span><b><strong>Gaussian Blurring, Median Blurring, Bilateral Filtering.</strong></b><span> Let’s make a couple of additions in our program and compare the results.</span></p><gfg-tabs data-run-ide="false" data-mode="light"><gfg-tab slot="tab">Python</gfg-tab><gfg-panel slot="panel" data-code-lang="python3"><pre><code class="language-python3"> # importing opencv CV2 module import cv2 # bat.jpg is the batman image. img = cv2.imread('gfg.png') # make sure that you have saved it in the same folder # Averaging # You can change the kernel size as you want avging = cv2.blur(img,(10,10)) cv2.imshow('Averaging',avging) cv2.waitKey(0) # Gaussian Blurring # Again, you can change the kernel size gausBlur = cv2.GaussianBlur(img, (5,5),0) cv2.imshow('Gaussian Blurring', gausBlur) cv2.waitKey(0) # Median blurring medBlur = cv2.medianBlur(img,5) cv2.imshow('Media Blurring', medBlur) cv2.waitKey(0) # Bilateral Filtering bilFilter = cv2.bilateralFilter(img,9,75,75) cv2.imshow('Bilateral Filtering', bilFilter) cv2.waitKey(0) cv2.destroyAllWindows() Original Image: Averaging: Gaussian Blurring: Media Blurring: Bilateral Filtering: How to Blur an Image using OpenCV? Visit Course Comment More infoAdvertise with us Next Article OpenCV - Invert Mask K kartik Follow Improve Article Tags : Project Python Image-Processing Python-OpenCV Practice Tags : python Similar Reads 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 b 5 min read 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 2 min read Node Jimp | Blur The blur() function is an inbuilt function in Nodejs | Jimp which uses a blur algorithm that produces a similar effect to a Gaussian blur. Syntax: blur(r, cb()) Parameter: r: This parameter stores the radius of the blur.cb: This is an optional parameter that is invoked when compilation is complet 1 min read Python Pillow - Blur an Image Blurring an image is a process of reducing the level of noise in the image, and it is one of the important aspects of image processing. In this article, we will learn to blur an image using a pillow library. To blur an image we make use of some methods of ImageFilter class of this library on image o 2 min read OpenCV - Invert Mask In this article, we will learn how to invert a mask created on an image in OpenCV. Masking is a technique used to highlight a specific object from the image. It can be defined as setting certain pixels of an image to some null value such as 0 (black color) so only that portion of our image is highli 4 min read Python OpenCV | cv2.blur() method OpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.blur() method is used to blur an image using the normalized box filter. The function smooths an image using the kernel which is represented as: Syntax: cv2.blur(src, ksize[, dst[, anchor[, borderType]]]) Pa 2 min read Like