Blur and Redact
Blurs and redacts any detected objects or regions in the video
Overview
Blurs and redacts any detected objects or regions in the video
Inputs & Outputs
- Inputs : 1, Media Format : Raw Video
- Outputs : 1, Media Format: Raw Video
- Output Metadata : None
Properties
| Property | Description | Type | Default | Required |
|---|---|---|---|---|
enabled | Enabled | bool | true | No |
roi_labels | Regions of interest labels | string | — | No |
rois | Regions of interest to blur and redact. Conditional on roi_labels. Format: comma-separated normalized x,y coordinate pairs; separate multiple polygons with semicolons (for example, 0.1,0.1,0.9,0.1,0.9,0.9). | string | null | No |
object_labels | ex. car,person,face.mask. Process detected objects with specified types depending on the mode. Use the object_label.class_label format to blur objects that also have a specific class. | model-labels | null | No |
mode | Include or exclude objects that match the specified types. Options: Include (include): Include objects that match the specified object types; Exclude (exclude): Exclude objects that don't match the specified object types. | enum | include | No |
blur_type | Blur method to use. Options: Simple (simple); Dense (gaussian); Opaque (opaque); Pixelated (pixel). | enum | pixel | No |
intensity | Blur intensity. Range: minimum 0, maximum 10. | integer | 7 | No |
Output Metadata
Node does not insert any output metadata; upstream metadata continues through the pipeline
Customize
In order to customize this node for your use case, use the code below inside a Function Node.
from lumeopipeline import VideoFrame
import cv2
def process_frame(frame: VideoFrame, object_labels = None, **kwargs) -> bool:
width = frame.video_info().width
height = frame.video_info().height
with frame.data() as mat:
meta = frame.meta()
if meta is not None:
objects = meta.get_field("objects")
if objects is not None:
object_label_list = object_labels.lower().replace(" ","").split(",") if object_labels is not None else []
for object in objects:
if object['label'] in object_label_list or len(object_label_list) == 0:
object_rect = object['rect']
object_rect = {key: int(value) for key, value in object_rect.items()}
y = object_rect['top']
yEnd = object_rect['top'] + object_rect['height']
x = object_rect['left']
xEnd = object_rect['left'] + object_rect['width']
mat[y:yEnd,x:xEnd] = cv2.blur(mat[y:yEnd,x:xEnd], (23,23) )
return TrueUpdated about 22 hours ago
Did this page help you?
