The overlay plug-in is used to draw shapes like bounding boxes, lines, arrows, circles, and polygons on a given frame or image. You can display a clock on any part of the frame by using the display-clock property. This plug-in employs the VVAS overlay library to produce different shapes, text, and clocks.
The overlay metadata structure, GstVvasOverlayMeta, must be used to provide the information about the objects like, bounding boxes, lines, and arrows to be drawn. This metadata must be attached to the input buffer. For more details about this overlay metadata structure, refer to the VVAS Overlay Metadata section.
To convert metadata generated from an upstream plug-in, such as vvas_xinfer, or segmentation into GstVvasOverlayMeta, an intermediate plug-in called vvas_xmetaconvert is provided, and this can be used before the vvas_xoverlay plug-in in gstreamer pipeline.
For insight into the implementation details, refer to the vvas_xoverlay source code located at <vvas>/vvas-gst-plugins/sys/overlay/.
Supported Features
Feature |
Description |
|---|---|
boxes |
Drawing bounding boxes with and without background color. |
text |
Overlaying of text with and without background color. Supports initial 5 of the Hershey fonts in OpenCv (SIMPLEX, PLAIN, DUPLEX, COMPLEX, TRIPLEX). |
lines |
For drawing lines with different thickness and color. |
arrows |
Drawing arrows on either side of line or both the sides. |
circle |
For drawing circles of different radius and thickness without fill. |
polygons |
For drawing closed polygons without fill. |
Input and Output
Supported input video formats are RGB, BGR, RGBA, BGRA, NV12, and GRAY8. Required metadata in GstVvasOverlayMeta for drawing.
Control Parameters and Plug-in Properties
The following table lists the GStreamer plug-in properties supported by the vvas_xoverlay plug-in.
Property Name |
Type |
Range |
Default |
Description |
|---|---|---|---|---|
display-clock |
Boolean |
true or false |
false |
Flag for indicating the display clock. |
clock-fontname |
Unsigned Integer |
0 or 7 |
0 |
Font number for clock based on OpenCV. |
clock-fontscale |
Float |
0 to 1.0 |
0.5 |
Font scale of the display clock. |
clock-fontcolor |
Unsigned Integer |
0 to 4294967295 |
0 |
RGB color of the display clock as 0xBGRA For example: If blue is the expected color, then 255, 0, 0, 0 must be packed into a 32 bit unsigned integer in the same order (BGRA). .. note:: Alpha channel is not used.(last 8 bits) |
clock-xoffset |
Unsigned Integer |
0 to 4294967295 |
0 |
X starting position. |
clock-yoffset |
Unsigned Integer |
0 to 4294967295 |
20 |
Y starting position. |
Example Pipelines
The following example demonstrates use of the vvas_xoverlay plug-in with the vvas_xinfer and vvas_xmetaconvert plug-ins for overlaying classification text. The vvas_xinfer plug-in produces an inference result and stores it in the GstInferenceMeta structure. This metadata is parsed and translated into the GstVvasOverlayMeta structure that is understood by the vvas_xoverlay plug-in to overlay the classification information. This translation of the metadata is done by the vvas_xmetaconvert plug-in.
Note
The JSONs provided below are only samples. Ensure
model-pathis set to point to your available model before running.
gst-launch-1.0 filesrc location=<INPUT>.bgr \
! rawvideoparse format=bgr width=<INPUT_WIDTH> height=<INPUT_HEIGHT> \
! queue \
! vvas_xinfer config-file=/etc/vvas/configs/infer/resnet50_onnxrt.json \
! vvas_xmetaconvert config-location=/etc/vvas/configs/metaconvert/metaconvert_config.json \
! vvas_xoverlay ! filesink location=out_overlay_resnet50.bgr