Overlay Drawing
helios.overlay draws simple shapes and text from CV Python. CV C++ provides the same features under Helios::Overlay.
Overlay calls belong inside process(frame).
Targets
| Python | C++ | Draws on |
|---|---|---|
overlay.FRAME |
Target::Frame |
Processed video frame |
overlay.FUSER |
Target::Fuser |
Fuser output |
overlay.BOTH |
Target::Both |
Both outputs |
The default target is BOTH, so a drawing appears on the processed frame and the Fuser output. Set FRAME or FUSER explicitly when only one output should receive it.
Python Example
from helios import overlay
class CVWorker:
def __init__(self, width, height):
pass
def process(self, frame):
overlay.rect(
100, 100, 300, 220,
color=(0, 255, 0),
thickness=2,
target=overlay.BOTH,
)
overlay.circle(
200, 160, 18,
color=(255, 0, 0),
filled=True,
)
overlay.text(
"TARGET",
200, 90,
color=(255, 255, 255),
background_color=(0, 0, 0),
background_alpha=140,
padding=5,
anchor=overlay.BOTTOM_CENTER,
)Overlay colors use RGB order. A four-value color tuple may include alpha, and an explicit alpha= value takes priority.
Primitives
overlay.line(x1, y1, x2, y2, color=(255, 255, 255),
thickness=1, target=overlay.BOTH, alpha=None,
space=overlay.PIXELS)
overlay.rect(x1, y1, x2, y2, color=(255, 255, 255),
thickness=1, target=overlay.BOTH, alpha=None,
filled=False, space=overlay.PIXELS)
overlay.circle(x, y, radius, color=(255, 255, 255),
thickness=1, target=overlay.BOTH, alpha=None,
filled=False, space=overlay.PIXELS)
overlay.text(value, x, y, color=(255, 255, 255), scale=2,
target=overlay.BOTH, alpha=None,
background_color=None, background_alpha=None,
padding=0, anchor=overlay.TOP_LEFT,
space=overlay.PIXELS)overlay.rectangle(...) is an alias for overlay.rect(...). A rectangle or circle is filled when filled=True or its thickness is zero or negative.
Coordinates and Text Anchors
overlay.PIXELS uses the current frame's pixel coordinates. overlay.DESIGN_1080P lets a fixed HUD layout scale from a 1920Ã1080 design.
Text anchors are:
TOP_LEFT,TOP_CENTER,TOP_RIGHTCENTER_LEFT,CENTER,CENTER_RIGHTBOTTOM_LEFT,BOTTOM_CENTER,BOTTOM_RIGHT
When background_color is set without background_alpha, the background uses a semi-transparent default.
C++
Helios::Overlay::rect(
100, 100, 300, 220,
Helios::Overlay::Color{0, 255, 0},
2,
Helios::Overlay::Target::Both);
Helios::Overlay::text(
200, 90,
"TARGET",
Helios::Overlay::Color{255, 255, 255},
2,
Helios::Overlay::Target::Fuser,
Helios::Overlay::TextAnchor::BottomCenter);C++ also provides line, circle, coordinate-space selection, alpha colors, text backgrounds, and OpenCV convenience overloads. Helios::Overlay::Color uses RGB; OpenCV cv::Scalar overloads use their usual BGR order.
Use OpenCV drawing when a script needs OpenCV-specific fonts, contours, polygons, ellipses, or line styles.
Raw Video Preview
Enable Preferences â Other â Video Display â Disable Overlay Drawing when you need to inspect the unannotated video. Helios continues script, inference, and OCR processing and still produces results, but skips their drawing on Video Display.