VOOZH about

URL: https://www.geeksforgeeks.org/python/faces-blur-in-videos-using-opencv-in-python/

⇱ Faces Blur in Videos using OpenCV in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Faces Blur in Videos using OpenCV in Python

Last Updated : 23 Jul, 2025

OpenCV is an open-source cross-platform library for various operating systems, including Windows, Linux, and macOS, for computer vision, machine learning, and image processing. With the help of OpenCV, we can easily process images and videos to recognize objects, faces, or even someone's handwriting.

In this article, we will see how to blur faces in images and videos using OpenCV in Python.

Requirements

In addition to the OpenCV module and in order to recognize faces, we also need Haar Cascade Frontal Face Classifier, which needs to be downloaded. It is provided as an XML file and is used to detect faces in images and videos.

Make sure to download the Haar Cascade Frontal Face Classifier from this link: haarcascade_frontalface_default.xml.

Blur the faces in Images using OpenCV in  Python

First, we will load an image that contains some faces so, that we can test our code. After that, we will convert it into RGB format and then detect faces using the haar cascade classifier. After this, we will get the bounding box coordinates by using which we will blur that particular region, and then we can show that image along with the original image.

Output:

👁 Blur the faces in Images using OpenCV in Python
Original image and the blurred face image

Blur the faces in Videos using OpenCV in  Python

First, we will load a video that contains some faces so, that we can test our code. After that, we will convert it into grayscale and then detect faces using the haar cascade classifier. After this, we will get the bounding box coordinates by using which we will blur that particular region, and then we can show that video.

Output:

Comment