display package
Subpackages
Submodules
display.display module
Class Display
- class display.display.Display(config_file: str)
Bases:
object
Display class, defines functions of cameras, and BEV display
- get_configuration()
Get the current display configuration
- Returns:
The current display configuration. None if no configuration file was used or configured through the request.
- Return type:
DisplayConfiguration or None
- get_heatmap()
Get the heatmap configuration
- Returns:
True or False, indicating whether the heatmap is being displayed. None if no configuration file was used or configured through the request.
- Return type:
bool or None
- set_configuration(config: rrmsutils.models.display.displayconfiguration.DisplayConfiguration)
Set the current display configuration.
- Parameters:
config (DisplayConfiguration) – The new configuration to be
display. (applied to the)
- Returns:
True if the configuration is successfully applied, False if the stream could not be set.
- Return type:
True or False
- set_heatmap(config: rrmsutils.models.display.heatmap.Heatmap)
Enable or disable the display of the heatmap.
- Parameters:
config (Heatmap) – heatmap configuration indicating whether
not. (the heatmap is used or)
- Returns:
True if the configuration is successfully applied, False if the stream could not be configured.
- Return type:
True or False
- start()
Starts the display pipeline by initializing and launching a separate thread.
- stop()
Stops the display pipeline.
- Returns:
True if the pipeline stopped successfully, False otherwise.
- Return type:
bool
display.displaymetaoverlay module
Display overlay utilities for rendering boxes, labels, and circles on video streams.
- class display.displaymetaoverlay.DisplayMetaOverlay
Bases:
object
A class to handle drawing operations on display metadata for overlays.
- static draw_box(display_meta: pyds.NvDsDisplayMeta, index: int, x_position: int, y_position: int, width: int, height: int, color: list[float])
Draw a rectangular box on the display overlay.
- Parameters:
display_meta (NvDsDisplayMeta) – The display metadata where
drawn. (the box will be)
index (int) – The index identifying the box to draw.
x_position (int) – The X coordinate of the box’s top-left
corner.
y_position (int) – The Y coordinate of the box’s top-left
corner.
width (int) – The width of the box.
height (int) – The height of the box.
color (list[float]) – The color of the box in RGBA format.
- static draw_circle(display_meta: pyds.NvDsDisplayMeta, index: int, x_center: int, y_center: int, radius: int, color: list[float])
Draw a circle on the display overlay.
- Parameters:
display_meta (NvDsDisplayMeta) – The display metadata where
drawn. (the circle will be)
index (int) – The index identifying the circle to draw.
x_center (int) – The X coordinate of the circle’s center.
y_center (int) – The Y coordinate of the circle’s center.
radius (int) – The radius of the circle.
color (list[float]) – The color of the circle in RGBA
format.
- static draw_label(display_meta: pyds.NvDsDisplayMeta, index: int, display_text: str, x_position: int, y_position: int, font_size: int = 15)
Draw a label on the display overlay.
- Parameters:
display_meta (NvDsDisplayMeta) – The display metadata where
drawn. (the label will be)
index (int) – The index identifying the label’s position on
list. (the meta)
display_text (str) – The text to be displayed.
x_position (int) – The X coordinate for the label’s
position.
y_position (int) – The Y coordinate for the label’s
position.
font_size (int) – The size of the font for the label text.
display.heatmapmanager module
Heatmap Class
- class display.heatmapmanager.HeatmapManager
Bases:
object
Manages the retrieval of heatmap data from a Redis stream and keeps track of blobs to be rendered in the heatmap visualization.
- get_blobs() list[rrmsutils.models.heatmap.Blob]
Retrieves the current list of blobs.
- Returns:
A list of Blob objects with the blobs descriptions currently being tracked by the class.
- Return type:
list[Blob]
- heatmap_disable()
Stops the drawing of the heatmap by terminating the data retrieval loop.
- heatmap_enable()
Starts the drawing of the heatmap by initiating data retrieval in a separate thread.
display.heatmapoverlaymedia module
Heatmap Overlay Media Class
- class display.heatmapoverlaymedia.HeatmapOverlayMedia(description: str, retry: bool = True, retry_delay: int = 5, get_blobs: Callable = None, draw_heatmap: bool = True)
Bases:
Media
Heatmap Overlay Media Class, inherits from Media and add support to include the heatmap overlay
- update_heatmap_config(value: bool)
Update the heatmap configuration.
- Parameters:
value (bool) – A boolean indicating the desired state of
heatmap. (the)
- Returns:
True if the value was updated successfully, False if the value provided was not a boolean.
- Return type:
bool
display.logger module
Service Logger
- class display.logger.CustomFormatter(format_str)
Bases:
Formatter
Custom formatter for logging
- format(record)
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
- class display.logger.Logger
Bases:
object
This class contains the methods used to configure the service logger.
- LOGGER_NAME = 'display'
- classmethod get_logger()
Get logger with the given name
- Returns:
A logger object
- Return type:
logging
- classmethod init(log_level=20, log_file: str = None)
initialize the service logger
- Parameters:
log_level (optional) – Logging level as in logging. Defaults to logging.INFO.
log_file (str, optional) – Log file path. Defaults to None.
display.main module
Server entry point
- display.main.main()
Main application
- display.main.parse_args()
Parse arguments
display.media module
Media Class
- class display.media.Media(description: str, retry: bool = True, retry_delay: int = 5)
Bases:
object
Media Class, sets a Gstreamer pipeline, change its status, updates and gets the properties of the element specified
- get_caps(element_name)
Gets the value of an element caps property in the pipeline
- Parameters:
element_name (str) – Pipeline element to get the caps
from (property)
- Returns:
The value of the element caps property asked for. None if ‘element_name’ doesn’t exist in the pipeline or the property get fails.
- Return type:
property (str) or None
- get_element_by_name(element_name)
Gets an elementin the pipeline
- Parameters:
element_name (str) – Pipeline element to get
- Returns:
The Element. None if ‘element_name’ doesn’t exist in the pipeline or the get_by_name method fails.
- Return type:
element (Gst.Element) or None
- get_property(element_name, property_name)
Gets the value of an elements property in the pipeline
- Parameters:
element_name (str) – Pipeline element to get the property from
property_name (str) – Property in the pipeline element to get the value from
- Returns:
property; the value of the elements property asked for, None if the element doesn’t exist in the pipeline.
- Return type:
property or None
- play()
Plays (change the state) of the parsed pipeline :returns: True is stop is successful, False if not :rtype: True or False
- set_caps(element_name, caps)
Set the ‘caps’ in the pipeline ‘element_name’
- Parameters:
element_name (str) – Pipeline element to be changed
caps (str) – Caps to be changed in the caps property of pipeline element
- Returns:
True if the caps property is successfully set. False if ‘element_name’ is not present in the pipeline or the property set fails.
- Return type:
True or False
- set_property(element_name, property_name, value)
Set the ‘property_name’ in the pipeline ‘element_name’ to the specified ‘value’
- Parameters:
element_name (str) – Pipeline element to be changed
property_name (str) – Property in the pipeline element to be changed
value (str or float) – Value to be set in the property that belongs to the element in the pipeline
- Returns:
True if the pipeline element actually is in the pipeline. False if doesn’t.
- Return type:
True or False
- stop()
Stops (change the state) the pipeline played before :returns: True is stop is successful, False if not :rtype: True or False
display.server module
Base HTTP server using Flask.