Blurring Faces to Preserve Privacy with Computer Vision A Roboflow tutorial demonstrates building an anonymization step that detects faces and license plates with a trained computer vision model and blurs or pixelates each region of interest before images enter a storage pipeline, following the approach Google uses to censor faces in Google Maps Street View imagery. The walkthrough trains detection models on face and license plate datasets from Roboflow Universe, then calls the model through the Roboflow inference SDK and applies blur via supervision, Roboflow's open source computer vision library, using a kernel_size of 35 to hide facial features without smearing surrounding areas. The technique is presented as a drop-in privacy layer for image, video, or livestream pipelines that leaves downstream processing unchanged. Automatically blurring faces and license plates before data enters a storage pipeline is a practical way to handle personally identifiable information in computer vision deployments, following the same approach used by Google Maps Street View. This tutorial covers collecting face and license plate datasets from Roboflow Universe, training a detection model, and using the Roboflow API to run inference and then apply OpenCV blur or pixelation to each detected region of interest. The result is an anonymization step that can be inserted into any image or video pipeline without changing downstream processing. 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? How to train models to detect faces and license plates from a given image. 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. Pixelizationis 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. Steps Involved for Blurring Faces with Computer Vision Along with model performance data, we also have access to visualizations for the training and validation curves. 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. 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 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: 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. Faces are oval, so the helper below keeps the blur inside an ellipse fitted to each box instead of the whole rectangle. A larger kernel size gives a stronger blur; 35 hides facial features without smearing the area around the face. Python python import numpy as np def anonymize image, detections, annotator : Run the annotator on each box, then keep its result only inside an ellipse fitted to the box, since faces are oval. annotated = annotator.annotate scene=image.copy , detections=detections mask = np.zeros image.shape :2 , dtype=np.uint8 for x1, y1, x2, y2 in detections.xyxy.astype int : center = x1 + x2 // 2, y1 + y2 // 2 axes = x2 - x1 // 2, y2 - y1 // 2 cv2.ellipse mask, center, axes, 0, 0, 360, 255, -1 return np.where mask ..., None == 255, annotated, image blur annotator = sv.BlurAnnotator kernel size=35 blurred = anonymize image, detections, blur annotator cv2.imwrite "blurred.jpg", blurred To pixelate instead, pass a PixelateAnnotator to the same helper. A larger pixel size gives bigger blocks. Python pixelate annotator = sv.PixelateAnnotator pixel size=12 pixelated = anonymize image, detections, pixelate annotator cv2.imwrite "pixelated.jpg", pixelated 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 helper works frame by frame. sv.process video reads a video, runs your callback on each frame, and writes the anonymized result: Python 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 anonymize frame, detections, blur annotator sv.process video source path="input.mp4", target path="blurred.mp4", callback=callback Start Your First Blurring Project with Computer Vision