Blurring Faces to Preserve Privacy with Computer Vision

Lukka ChaitanyaPublished Nov 18, 2026
5 min read

Quote of the day:
“Keep calm and carry on.”  -Winston Churchill

Computer vision applications can be used in a variety of settings and sometimes information captured in your dataset might not be information you want to be responsible for having such as personally identifiable information, banking information, or any other sensitive data.

In these instances, you can ensure the data is anonymized by blurring, pixelating, or fogging any specific data before it enters your database. This post will show you how to do this using computer vision.

What to expect from this blog post?

  1. How to train models to detect faces and license plates from a given image.
  2. Using the Roboflow API (opens in a new tab) to run the trained model on your custom images.
  3. Automatically censor detected faces (opens in a new tab) and license plates to anonymize data captured in computer vision projects.

What is Fogging or Blurring in Computer Vision?

Fogging, also known as blurring, is used for censorship or privacy in which a visual area of any image, video, or livestream is blurred to obscure the data captured.

Example of face blurring or fogging with computer vision
Example of license plate fogging

Pixelization is also a form of fogging. This technique is used widely across industries from street mapping to news reporting to social media.

Example: Face Blurring Used in Google Maps

When Street View imagery is published to Google Maps, Google employs censoring faces to protect individuals’ privacy.

Google Maps blurring faces preserving privacy

Steps Involved for Blurring Faces with Computer Vision

Just 3 simple steps:

  • Step 1: Collect data
  • Step 2: Train a model
  • Step 3: Use the Roboflow API to deploy the model

Collect Data of Faces for Model Training

Luckily, we have Roboflow Universe (opens in a new tab) which is home to the world's largest collection of annotated and ready to use datasets related to various industries such as self-driving cars (opens in a new tab) and agriculture (opens in a new tab), to manufacturing (opens in a new tab) and gaming (opens in a new tab) that are open source and free to use. Tip: Search using the keyword 'faces' or 'license plates' and we are ready to go

Visual tutorial on how to collect data using Roboflow Universe

In addition to downloading the datasets, you can also clone data from Roboflow Universe (opens in a new tab) directly to a project in your Roboflow account.

If you need additional data beyond what is provided in Universe, you can upload Youtube videos as training data (opens in a new tab) or upload your own data (opens in a new tab). Then you'll use Roboflow Annotate to label the data for model training.

Train a Face Detection Model

We then upload our downloaded image dataset to the Roboflow app to train our model to detect faces. This process can be done for any data you want to obfuscate and anonymize such as license plates (opens in a new tab) and identification cards (opens in a new tab).

Steps to train a face blurring model using Roboflow

After uploading your dataset, properly labeling the data, adding augmentations, and generating the dataset, you can train a computer vision model with one-click using Roboflow Train.

Below are the results after training the model using the Accurate model (opens in a new tab) in Roboflow.

One-click training results using Roboflow

Along with model performance data, we also have access to visualizations for the training and validation curves.

Model training visualizations

Using the Computer Vision Model to Censor the Region of Interest (ROI)

After successfully training the model, go to the Deploy page (opens in a new tab) and use the API script provided to censor the images.

Roboflow deployment API

After training, call your model from Python with the Roboflow inference SDK, then use supervision (opens in a new tab), Roboflow's open source computer vision library, to blur or pixelate every detected face. Install both packages:

Shell
pip install inference-sdk supervision

Run the model on an image and convert the response into a supervision Detections object. Replace MODEL_ID with your project ID and version from your model's Deploy page (opens in a new tab), and add your Roboflow API key.

Python
import cv2
import supervision as sv
from inference_sdk import InferenceHTTPClient

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key="YOUR_ROBOFLOW_API_KEY",
)
MODEL_ID = "your-project/1"  # your face (or license plate) model ID and version

image = cv2.imread("people.jpg")
result = client.infer(image, model_id=MODEL_ID)
detections = sv.Detections.from_inference(result)
detections = detections[detections.confidence > 0.4]

The model returns one prediction per face with the box center, width, height, class, and confidence:

Sample JSON output from the model

After the prediction, extract the region of interest (ROI):

Python
roi = sv.crop_image(image=image, xyxy=detections.xyxy[0])

To blur every face, use BlurAnnotator. A larger kernel_size gives a stronger blur; 35 hides facial features without overdoing it.

Python
blur_annotator = sv.BlurAnnotator(kernel_size=35)
blurred = blur_annotator.annotate(scene=image.copy(), detections=detections)
cv2.imwrite("blurred.jpg", blurred)

To pixelate instead, use PixelateAnnotator. A larger pixel_size gives bigger blocks.

Python
pixelate_annotator = sv.PixelateAnnotator(pixel_size=12)
pixelated = pixelate_annotator.annotate(scene=image.copy(), detections=detections)
cv2.imwrite("pixelated.jpg", pixelated)
Example usage of protecting children's privacy

Both annotators cover every face the model finds, so group photos and crowded scenes are handled in one call.

Blur Faces in Video

The same annotator works frame by frame. sv.process_video reads a video, runs your callback on each frame, and writes the anonymized result:

Python
def callback(frame, index):
    result = client.infer(frame, model_id=MODEL_ID)
    detections = sv.Detections.from_inference(result)
    detections = detections[detections.confidence > 0.4]
    return blur_annotator.annotate(scene=frame.copy(), detections=detections)

sv.process_video(source_path="input.mp4", target_path="blurred.mp4", callback=callback)

Privacy Safeguards in Roboflow Enterprise

To enforce masking across every camera and upload, not just one script, the Roboflow Enterprise platform builds it in. Talk to sales to set it up for your team.

A worker in a factory photo is masked out before the team sees the image, with examples of masked faces, hands, plates, ID badges, wristbands, and patient records, next to four safeguards: sensitive data masking, governed uploads, verification with evals, and sensitivity tags
Uploaded images are masked before your team sees them.

Start Your First Blurring Project with Computer Vision

Hopefully you can use parts of this application to build your own project. To get started, find a dataset in Roboflow Universe (opens in a new tab), consider the best method for deploying your model, and ship your first project.

If you end up building something, please share it in our forum (opens in a new tab)!

More AboutSafety & Security

Get started

Build on the Platform

For developers, engineers, and technical founders who want to get hands on. Try the free tier; the docs are open.

Bring it into your operation

For heads of AI, operations leaders, and enterprise teams. Bring a known problem, or work with us to find the first one worth taking on.