Display Stream Info
Display stream meta and info on the video stream
Overview
Displays metadata on the video stream
Inputs & Outputs
- Inputs : 1, Media Format : Raw Video
- Outputs : 1, Media Format: Raw Video
- Output Metadata : None
Properties
Property | Value |
---|---|
show_fps | Display effective frame rate at which the video is being processed. Boolean. \n \nex. true / false |
show_objects | If enabled, Location relative to detected object where the label will be displayed along with bounding box. \n \nOptions: disabled , bottom_left , bottom_right , top_left , top_right |
show_object_detail | If enabled, shows Object's Tracking IDs and Confidence scores when Display Objects is enabled. \n \nEx. true/false |
object_types | If specified, only display objects of these types. Else displays all objects. \n \nEx. car,person \n \nAccepted formats: \nobject_label : any object of this type, with or without a classifier attribute. Example: car \n \nobject_label.class_type : any object of this type that has a specific classifier attribute. Example: car.red \n \nobject_label.* : any object of this type that has at least one classifier attribute. Example: car.* (this will match car.red , car.yellow , etc) |
highlight_object_types | If specified, highlights objects of these types. Else highlights no objects. \n \nEx. car,person \n \nAccepted formats: \nobject_label : any object of this type, with or without a classifier attribute. Example: car \n \nobject_label.class_type : any object of this type that has a specific classifier attribute. Example: car.red \n \nobject_label.* : any object of this type that has at least one classifier attribute. Example: car.* (this will match car.red , car.yellow , etc) |
show_metadata | Display stream metadata contained in the video frame. Boolean. \n \nex. true / false |
log_metadata | Log stream metadata contained in the video frame to Console, so it can be viewed under Deployment -> Logs tab. Boolean. \n \nex. true / false |
meta_list | Comma separated list of metadata properties to display/log. \nThe set of available properties is the combination of individual metadata properties added by all nodes previous to this node. \n \nExample: \nvideo1.source_name - This will display the stream name on the video. |
Metadata
Access metadata using the Function Node or using the API, from the snapshot or clip saved downstream of this node.
Metadata Property | Description |
---|---|
None | None |
Customize
In order to customize this node for your use case, use the code below inside a Function Node.
from lumeopipeline import VideoFrame # Lumeo lib to access frame and metadata
from lumeopipeline import Utils
import time
FPS_MEASUREMENT_INTERVAL = 30
frame_count = 0
fps = 0
last_epoch = time.time()
meta_keys_to_show = None
def process_frame(frame: VideoFrame, show_fps=False, show_metadata=False, log_metadata=False, meta_list=None, node_id=None, **kwargs) -> bool:
global frame_count
global fps
global last_epoch
global meta_keys_to_show
global FPS_MEASUREMENT_INTERVAL
show_fps = (show_fps in ["true", "True", True])
show_metadata = (show_metadata in [u'true', u'True', True])
log_metadata = (log_metadata in [u'true', u'True', True])
if meta_keys_to_show is None:
meta_keys_to_show = meta_list.replace(" ","").split(",") if meta_list is not None else []
frame_count = frame_count + 1
if frame_count % FPS_MEASUREMENT_INTERVAL == 0:
time_elapsed = time.time() - last_epoch
fps = int(FPS_MEASUREMENT_INTERVAL/time_elapsed)
last_epoch = time.time()
with frame.data() as mat:
yidx = 50
if show_fps:
(label_width, label_height) = Utils.write_label_on_frame(mat, 25, yidx, "FPS: " + str(fps))
yidx = yidx + label_height
if (show_metadata or log_metadata):
try:
meta = frame.meta()
if meta is not None:
for (key, value) in meta.get_all().items():
if value is not None and (len(meta_keys_to_show) == 0 or key in meta_keys_to_show):
if len(meta_keys_to_show) == 0:
label = key + " : " + str(value)
else:
label = str(value)
if show_metadata:
(label_width, label_height) = Utils.write_label_on_frame(mat, 25, yidx, label)
yidx = yidx + label_height
if log_metadata:
print("[{}] {}".format(node_id, label))
except Exception as error:
print(error, flush=True)
pass
return True
Updated 9 days ago