This article explains how to add blur to an image using OpenCV. Motion blur is a specific type of blur used to lend a directed blur effect to images.
The Motion Blur Filter
Applying motion blur to an image boils down to convolving a filter across the image. Sample 5*5 filter filters are given below.
The greater the size of the filter, the greater will be the motion blur effect. Further, the direction of 1’s across the filter grid is the direction of the desired motion. To customize a motion blur in a specific vector direction, e.g. diagonally, simply place the 1’s along the vector to create the filter.
Consider the following image of a car.
Code: Python code for applying a motion blur effect on the image.
- Python OpenCV | cv2.blur() method
- OpenCV Python Program to blur an image
- WebCam Motion Detector in Python
- Box Blur Algorithm - With Python implementation
- Python OpenCV: Meanshift
- OpenCV Python Tutorial
- How to install OpenCV for Python in Linux?
- Image Steganography using OpenCV in Python
- Python | Background subtraction using OpenCV
- Detect an object with OpenCV-Python
- How to install OpenCV for Python in Windows?
- Python OpenCV | cv2.rectangle() method
- Reading an image in OpenCV using Python
- Image Registration using OpenCV | Python
- Python OpenCV | cv2.cvtColor() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.