Blur Objects Node

Blur objects detected by the Model Inference Node

Inputs & Outputs

  • Inputs : 1, Media Format : Raw Video
  • Outputs : 1, Media Format: Raw Video
  • Output Metadata : None





Comma separated list of detected object labels to blur (see Model Labels for a list of labels detected by that model )

Specified as object_label or object_label.class_label

Ex. :
face : Blurs all face objects
face.mask : Blurs all objects of type face which also have a class of mask


Access metadata using the Function Node or using the API, from the snapshot or clip saved downstream of this node.

Metadata Property





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 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 True

Did this page help you?