savant_rs.primitives

class savant_rs.primitives.Attribute(namespace, name, values, hint=None, is_persistent=True, is_hidden=False)

Attribute represents a specific knowledge about certain entity. The attribute is identified by (creator, label) pair which is unique within the entity. The attribute value is a list of values, each of which has a confidence score. The attribute may include additional information in the form of a hint. There are two kinds of attributes: persistent and non-persistent. Persistent attributes are serialized, while non-persistent are not.

The list nature of attribute values is used to represent complex values of the same attribute. For example, the attribute (person_profiler, bio) may include values in the form ["Age", 32, "Gender", None, "Height", 186]. Each element of the list is AttributeValue.

static from_json(json)
hint

Returns the hint of the attribute.

Returns:

The hint of the attribute or None if no hint is set.

Return type:

str or None

is_hidden()

Checks if the attribute is hidden.

Returns:

True if the attribute is hidden, False otherwise.

Return type:

bool

is_temporary()

Returns True if the attribute is persistent, False otherwise.

Returns:

True if the attribute is persistent, False otherwise.

Return type:

bool

json
make_persistent()

Changes the attribute to be persistent.

Returns:

The attribute is changed in-place.

Return type:

None

make_temporary()

Changes the attribute to be non-persistent.

Returns:

The attribute is changed in-place.

Return type:

None

name

Returns the name of the attribute.

Returns:

The name of the attribute.

Return type:

str

namespace

Returns the namespace of the attribute.

Returns:

The namespace of the attribute.

Return type:

str

static persistent(namespace, name, values, hint=None, is_hidden=False)

Alias to constructor method. Creates a persistent attribute.

Parameters:
  • namespace (str) – The namespace of the attribute.

  • name (str) – The name of the attribute.

  • values (List[AttributeValue]) – The values of the attribute.

  • hint (str, optional) – The hint of the attribute. The hint is a user-defined string that may contain additional information about the attribute.

  • is_hidden (bool, optional) – If True, the attribute is hidden and the user must know its full name to access it.

Returns:

The created attribute.

Return type:

Attribute

static temporary(namespace, name, values, hint=None, is_hidden=False)

Alias to constructor method for non-persistent attributes.

Parameters:
  • namespace (str) – The namespace of the attribute.

  • name (str) – The name of the attribute.

  • values (List[AttributeValue]) – The values of the attribute.

  • hint (str, optional) – The hint of the attribute. The hint is a user-defined string that may contain additional information about the attribute.

  • is_hidden (bool, optional) – If True, the attribute is hidden and the user must know its full name to access it.

Returns:

The created attribute.

Return type:

Attribute

values

Returns the values of the attribute. The values are returned as copies, changing them will not change the attribute. To change the values of the attribute, use assignment to the values attribute.

Returns:

The values of the attribute.

Return type:

List[AttributeValue]

values_view

Returns a link to attributes without retrieving them. It is convenience method if you need to access certain value.

class savant_rs.primitives.AttributeUpdatePolicy

Allows setting the policy for resolving collisions when updating attributes in the frame with VideoFrameUpdate.

There are four policies:
  • the one to replace with foreign attributes when duplicates are found;

  • the one to keep own attributes when duplicates are found;

  • the one to error when duplicates are found;

  • the one to prefix duplicates with a given string.

ErrorWhenDuplicate = AttributeUpdatePolicy.ErrorWhenDuplicate
KeepOwnWhenDuplicate = AttributeUpdatePolicy.KeepOwnWhenDuplicate
ReplaceWithForeignWhenDuplicate = AttributeUpdatePolicy.ReplaceWithForeignWhenDuplicate
class savant_rs.primitives.AttributeValue
as_bbox()

Returns the value of attribute as a savant_rs.primitives.geometry.RBBox or None if not a bounding box type.

Returns:

The value of attribute as a savant_rs.primitives.geometry.RBBox or None if not a bounding box type.

Return type:

Optional[savant_rs.primitives.geometry.RBBox]

as_bboxes()

Returns the value of attribute as a list of savant_rs.primitives.geometry.RBBox or None if not a list of bounding boxes type.

Returns:

The value of attribute as a list of savant_rs.primitives.geometry.RBBox or None if not a list of bounding boxes type.

Return type:

Optional[List[savant_rs.primitives.geometry.RBBox]]

as_boolean()

Returns the value of attribute as a boolean or None if not a boolean type.

Returns:

The value of attribute as a boolean or None if not a boolean type.

Return type:

Optional[bool]

as_booleans()

Returns the value of attribute as a list of booleans or None if not a list of booleans type.

Returns:

The value of attribute as a list of booleans or None if not a list of booleans type.

Return type:

Optional[List[bool]]

as_bytes()

Returns the value of attribute as (dims, bytes) tuple or None if not a bytes type.

Returns:

The value of attribute as (dims, bytes) tuple or None if not a bytes type.

Return type:

Optional[Tuple[List[int], bytes]]

as_float()

Returns the value of attribute as a float or None if not a float type.

Returns:

The value of attribute as a float or None if not a float type.

Return type:

Optional[float]

as_floats()

Returns the value of attribute as a list of floats or None if not a list of floats type.

Returns:

The value of attribute as a list of floats or None if not a list of floats type.

Return type:

Optional[List[float]]

as_integer()

Returns the value of attribute as an integer or None if not an integer type.

Returns:

The value of attribute as an integer or None if not an integer type.

Return type:

Optional[int]

as_integers()

Returns the value of attribute as a list of integers or None if not a list of integers type.

Returns:

The value of attribute as a list of integers or None if not a list of integers type.

Return type:

Optional[List[int]]

as_intersection()

Returns the value of attribute as an savant_rs.primitives.geometry.Intersection or None if not an intersection type.

Returns:

The value of attribute as an savant_rs.primitives.geometry.Intersection or None if not an intersection type.

Return type:

Optional[savant_rs.primitives.geometry.Intersection]

as_point()

Returns the value of attribute as a savant_rs.primitives.geometry.Point or None if not a point type.

Returns:

The value of attribute as a savant_rs.primitives.geometry.Point or None if not a point type.

Return type:

Optional[savant_rs.primitives.geometry.Point]

as_points()

Returns the value of attribute as a list of savant_rs.primitives.geometry.Point or None if not a list of points type.

Returns:

The value of attribute as a list of savant_rs.primitives.geometry.Point or None if not a list of points type.

Return type:

Optional[List[savant_rs.primitives.geometry.Point]]

as_polygon()

Returns the value of attribute as a savant_rs.primitives.geometry.PolygonalArea or None if not a polygon type.

Returns:

The value of attribute as a savant_rs.primitives.geometry.PolygonalArea or None if not a polygon type.

Return type:

Optional[savant_rs.primitives.geometry.PolygonalArea]

as_polygons()

Returns the value of attribute as a list of savant_rs.primitives.geometry.PolygonalArea or None if not a list of polygons type.

Returns:

The value of attribute as a list of savant_rs.primitives.geometry.PolygonalArea or None if not a list of polygons type.

Return type:

Optional[List[savant_rs.primitives.geometry.PolygonalArea]]

as_string()

Returns the value of attribute as a string or None if not a string type.

Returns:

The value of attribute as a string or None if not a string type.

Return type:

Optional[str]

as_strings()

Returns the value of attribute as a list of strings or None if not a list of strings type.

Returns:

The value of attribute as a list of strings or None if not a list of strings type.

Return type:

Optional[List[str]]

as_temporary_python_object()
static bbox(bbox, confidence=None)

Creates a new attribute value of bounding box type.

Parameters:
Returns:

The attribute value.

Return type:

AttributeValue

static bboxes(bboxes, confidence=None)

Creates a new attribute value of list of bounding boxes type.

Parameters:
Returns:

The attribute value.

Return type:

AttributeValue

static boolean(b, confidence=None)

Creates a new attribute value of boolean type.

Parameters:
  • b (bool) – The boolean value.

  • confidence (float, optional) – The confidence of the attribute value.

Returns:

The attribute value.

Return type:

AttributeValue

static booleans(bb, confidence=None)

Creates a new attribute value of list of booleans type.

Parameters:
  • bb (List[bool]) – The list of booleans.

  • confidence (float, optional) – The confidence of the attribute value.

Returns:

The attribute value.

Return type:

AttributeValue

static bytes(dims, blob, confidence=None)

Creates a new attribute value of blob type.

Parameters:
  • dims (list of int) – The dimensions of the blob.

  • blob (bytes) – The blob.

  • confidence (float, optional) – The confidence of the attribute value.

Return type:

AttributeValue

static bytes_from_list(dims, blob, confidence=None)

Creates a new attribute value of blob type.

Parameters:
  • dims (list of int) – The dimensions of the blob.

  • blob (List[int]) – The blob.

  • confidence (float, optional) – The confidence of the attribute value.

Return type:

AttributeValue

confidence
static float(f, confidence=None)

Creates a new attribute value of float type.

Parameters:
  • f (float) – The float value.

  • confidence (float, optional) – The confidence of the attribute value.

Returns:

The attribute value.

Return type:

AttributeValue

static floats(ff, confidence=None)

Creates a new attribute value of list of floats type.

Parameters:
  • ff (List[float]) – The list of floats.

  • confidence (float, optional) – The confidence of the attribute value.

Returns:

The attribute value.

Return type:

AttributeValue

static from_json(json)
static integer(i, confidence=None)

Creates a new attribute value of integer type.

Parameters:
  • i (int) – The integer value.

  • confidence (float, optional) – The confidence of the attribute value.

Returns:

The attribute value.

Return type:

AttributeValue

static integers(ii, confidence=None)

Creates a new attribute value of list of integers type.

Parameters:
  • ii (List[int]) – The list of integers.

  • confidence (float, optional) – The confidence of the attribute value.

Returns:

The attribute value.

Return type:

AttributeValue

static intersection(int, confidence=None)

Creates a new attribute value of type savant_rs.primitives.geometry.Intersection.

Parameters:
Returns:

The attribute value.

Return type:

AttributeValue

is_none()

Checks if the attribute valus if of None type.

json
static none()

Creates a new attribute value of type None

Returns:

The attribute value.

Return type:

AttributeValue

static point(point, confidence=None)

Creates a new attribute value of point type.

Parameters:
Returns:

The attribute value.

Return type:

AttributeValue

static points(points, confidence=None)

Creates a new attribute value of list of points type.

Parameters:
Returns:

The attribute value.

Return type:

AttributeValue

static polygon(polygon, confidence=None)

Creates a new attribute value of polygon type.

Parameters:
Returns:

The attribute value.

Return type:

AttributeValue

static polygons(polygons, confidence=None)

Creates a new attribute value of list of polygons type.

Parameters:
Returns:

The attribute value.

Return type:

AttributeValue

static string(s, confidence=None)

Creates a new attribute value of string type.

Parameters:
  • s (str) – The string.

  • confidence (float, optional) – The confidence of the attribute value.

Returns:

The attribute value.

Return type:

AttributeValue

static strings(ss, confidence=None)

Creates a new attribute value of list of strings type.

Parameters:
  • ss (List[str]) – The list of strings.

  • confidence (float, optional) – The confidence of the attribute value.

Returns:

The attribute value.

Return type:

AttributeValue

static temporary_python_object(pyobj, confidence=None)
value_type

Returns the confidence of the attribute value.

Returns:

The type of the attribute value.

Return type:

AttributeValueType

class savant_rs.primitives.AttributeValueType

Represents attribute value types for matching

BBox = BBox
BBoxList = BBoxList
Boolean = Boolean
BooleanList = BooleanList
Bytes = Bytes
Float = Float
FloatList = FloatList
Integer = Integer
IntegerList = IntegerList
Intersection = Intersection
None_ = None_
Point = Point
PointList = PointList
Polygon = Polygon
PolygonList = PolygonList
String = String
StringList = StringList
TemporaryValue = TemporaryValue
class savant_rs.primitives.AttributeValuesView

Helper class allowing access attribute values without copying them from the object to a requesting party. The class suits well if you work with compound values and want to check value partially before accessing costly operations. It supports Python’s len(obj) and obj[i] operations, but only on reading.

memory_handle
class savant_rs.primitives.BorrowedVideoObject
attributes

Returns object’s attributes as a list of tuples (namespace, name).

Returns:

List of attribute identifiers as (namespace, name).

Return type:

List[Tuple[str, str]]

clear_attributes()

Clears all object’s attributes.

clear_track_info()
confidence

Returns object confidence if set. When used as setter, allows setting object’s confidence.

Returns:

Object’s confidence.

Return type:

float or None

delete_attribute(namespace, name)

Deletes an attribute from the object. If the attribute is not found, returns None, otherwise returns the deleted attribute.

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

Returns:

Deleted attribute or None if the attribute is not found.

Return type:

Attribute or None

delete_attributes_with_hints(hints)
delete_attributes_with_names(names)
delete_attributes_with_ns(namespace)
detached_copy()

Returns a copy of the object with the same properties but detached from the frame and without a parent set.

Returns:

A copy of the object.

Return type:

VideoObject

detection_box

Returns object’s bbox by value. Any modifications of the returned value will not affect the object. When used as setter, allows setting object’s bbox by value.

Returns:

Object’s bounding box.

Return type:

savant_rs.primitives.geometry.RBBox

draw_label

Returns object’s draw label if set. When used as setter, allows setting object’s draw label. If the draw label is not set, returns object’s label.

Returns:

Object’s draw label.

Return type:

str

find_attributes_with_hints(hints)
find_attributes_with_names(names)
find_attributes_with_ns(namespace)
get_attribute(namespace, name)

Fetches attribute by namespace and name. The attribute is fetched by value, not reference, however attribute’s values are fetched as CoW, until the modification the values are shared. If the attribute is not found, returns None.

Remember, because the attribute is fetched as a copy, that changing attribute properties will not change the attribute kept in the object.

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

Returns:

Attribute or None if the attribute is not found.

Return type:

Attribute or None

id

Returns the object’s id. The setter causes RuntimeError when the object is attached to a frame.

Returns:

Object’s id.

Return type:

int

label
label_id
memory_handle
namespace

Returns object’s namespace. When used as setter, allows setting object’s namespace.

Returns:

Object’s namespace.

Return type:

str

namespace_id
set_attribute(attribute)

Sets the attribute for the object. If the attribute is already set, it is replaced.

Parameters:

attribute (Attribute) – Attribute to set.

Returns:

Attribute that was replaced or None if the attribute was not set.

Return type:

Attribute or None

set_persistent_attribute(namespace, name, is_hidden=False, hint=None, values=Ellipsis)

Sets new persistent attribute for the object. If the attribute is already set, it is replaced.

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

  • hint (str or None) – Attribute hint.

  • is_hidden (bool) – Attribute hidden flag.

  • values (List[AttributeValue] or None) – Attribute values.

set_temporary_attribute(namespace, name, is_hidden=False, hint=None, values=Ellipsis)

Sets new temporary attribute for the object. If the attribute is already set, it is replaced.

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

  • hint (str or None) – Attribute hint.

  • is_hidden (bool) – Attribute hidden flag.

  • values (List[AttributeValue] or None) – Attribute values.

set_track_info(track_id, bbox)
to_protobuf(no_gil=True)
track_box
track_id
transform_geometry(ops)
class savant_rs.primitives.EndOfStream(source_id)
json
source_id
to_message()
class savant_rs.primitives.IdCollisionResolutionPolicy
Error = IdCollisionResolutionPolicy.Error
GenerateNewId = IdCollisionResolutionPolicy.GenerateNewId
Overwrite = IdCollisionResolutionPolicy.Overwrite
class savant_rs.primitives.ObjectUpdatePolicy

Allows setting the policy for resolving collisions when updating objects in the frame with VideoFrameUpdate.

There are three policies:
  • the one to just add objects;

  • the one to error if labels collide;

  • the one to replace objects with the same label.

AddForeignObjects = ObjectUpdatePolicy.AddForeignObjects
ErrorIfLabelsCollide = ObjectUpdatePolicy.ErrorIfLabelsCollide
ReplaceSameLabelObjects = ObjectUpdatePolicy.ReplaceSameLabelObjects
class savant_rs.primitives.Shutdown(auth)
auth
json
to_message()
class savant_rs.primitives.UserData(source_id)
attributes
clear_attributes()
delete_attribute(namespace, name)
delete_attributes_with_hints(hints)
delete_attributes_with_names(names)
delete_attributes_with_ns(namespace)
find_attributes_with_hints(hints)
find_attributes_with_names(names)
find_attributes_with_ns(namespace)
static from_protobuf(bytes, no_gil=True)
get_attribute(namespace, name)
json
json_pretty
set_attribute(attribute)
set_persistent_attribute(namespace, name, is_hidden=False, hint=None, values=Ellipsis)

Sets new persistent attribute for the user data. If the attribute is already set, it is replaced.

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

  • hint (str or None) – Attribute hint.

  • is_hidden (bool) – Attribute hidden flag.

  • values (List[AttributeValue] or None) – Attribute values.

set_temporary_attribute(namespace, name, is_hidden=False, hint=None, values=Ellipsis)

Sets new temporary attribute for the user data. If the attribute is already set, it is replaced.

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

  • hint (str or None) – Attribute hint.

  • is_hidden (bool) – Attribute hidden flag.

  • values (List[AttributeValue] or None) – Attribute values.

source_id
to_message()
to_protobuf(no_gil=True)
class savant_rs.primitives.VideoFrame(source_id, framerate, width, height, content, transcoding_method=Ellipsis, codec=None, keyframe=None, time_base=Ellipsis, pts=0, dts=None, duration=None)
access_objects(q, no_gil=True)
access_objects_with_ids(ids)
add_object(o, policy)
add_transformation(transformation)

Adds transformation record for a frame

Parameters:

transformation (savant_rs.primitives.VideoFrameTransformation)

attributes

Returns the list of attributes

Returns:

The list of attributes (namespace, name)

Return type:

List[Tuple[str, str]]

clear_attributes()
clear_objects()
clear_parent(q, no_gil=True)
clear_transformations()

Resets all transformation records for a frame

codec
content
copy(no_gil=True)
create_object(namespace, label, parent_id=None, confidence=None, detection_box=None, track_id=None, track_box=None, attributes=None)
creation_timestamp_ns
delete_attribute(namespace, name)

Deletes the attribute object by namespace and name

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

Returns:

The deleted attribute object

Return type:

Optional[savant_rs.primitives.Attribute]

delete_attributes_with_hints(hints)
delete_attributes_with_names(names)
delete_attributes_with_ns(namespace)
delete_objects(q, no_gil=True)
delete_objects_with_ids(ids)
dts
duration
find_attributes_with_hints(hints)
find_attributes_with_names(names)
find_attributes_with_ns(namespace)
framerate
static from_protobuf(bytes, no_gil=True)
get_all_objects()
get_attribute(namespace, name)

Returns the attribute object by namespace and name

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

Returns:

The attribute object

Return type:

savant_rs.primitives.Attribute

get_children(id)
get_object(id)
height
json
json_pretty
keyframe
memory_handle

Allows getting raw pointer to a frame for 3rd-party integration.

Returns:

The pointer to the frame.

Return type:

int

previous_frame_seq_id

Returns the previous frame sequence ID for the frame within the sender connection.

Returns:

The previous frame sequence ID for the frame.

Return type:

Optional[int]

previous_keyframe_uuid
pts

Returns frame PTS

Returns:

The frame PTS

Return type:

int

set_attribute(attribute)
set_draw_label(q, draw_label, no_gil=False)
set_parent(q, parent, no_gil=True)
set_parent_by_id(object_id, parent_id)
set_persistent_attribute(namespace, name, is_hidden=False, hint=None, values=Ellipsis)

Sets new persistent attribute for the frame. If the attribute is already set, it is replaced.

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

  • hint (str or None) – Attribute hint.

  • is_hidden (bool) – Attribute hidden flag.

  • values (List[AttributeValue] or None) – Attribute values.

set_temporary_attribute(namespace, name, is_hidden=False, hint=None, values=Ellipsis)

Sets new temporary attribute for the frame. If the attribute is already set, it is replaced.

Parameters:
  • namespace (str) – Attribute namespace.

  • name (str) – Attribute name.

  • hint (str or None) – Attribute hint.

  • is_hidden (bool) – Attribute hidden flag.

  • values (List[AttributeValue] or None) – Attribute values.

source_id

Returns the source ID for the frame.

Returns:

The source ID for the frame.

Return type:

str

time_base

Returns stream time base for the frame.

Returns:

The stream time base for the frame.

Return type:

Tuple[int, int]

to_message()

Creates protocol message (savant_rs.utils.serialization.Message) from the frame.

Returns:

The protocol message.

Return type:

savant_rs.utils.serialization.Message

to_protobuf(no_gil=True)
transcoding_method
transform_geometry(ops, no_gil=True)

Applies transformation operations ot all objects within the frame.

Parameters:
  • ops (List[savant_rs.primitives.VideoObjectBBoxTransformation]) – The list of transformation operations to apply.

  • no_gil (bool) – Whether to release the GIL while applying the transformations.

transformations

Returns the list of transformations

Returns:

The list of transformations

Return type:

List[savant_rs.primitives.VideoFrameTransformation]

update(update, no_gil=True)

Updates the frame with the given update. The function is GIL-free.

The order of execution: - frame attributes are updated - existing objects are updated with attributes - new objects are added

Parameters:

update (savant_rs.primitives.VideoFrameUpdate) – The update to apply

Return type:

None

Raises:

ValueError – If the update cannot be applied to the frame

uuid
width
class savant_rs.primitives.VideoFrameBatch
access_objects(q, no_gil=True)
add(id, frame)
del_(id)
delete_objects(q, no_gil=True)
frames
static from_protobuf(bytes, no_gil=True)
get(id)
ids
to_protobuf(no_gil=True)
class savant_rs.primitives.VideoFrameContent

Represents the structure for accessing primary video content for the frame.

static external(method, location=None)
get_data()

Returns the video data as a Python bytes object if the content is internal, otherwise results in the TypeError exception.

Returns:

The video data as a Python bytes object.

Return type:

bytes

Raises:

TypeError – If the content is not internal.

get_location()

Returns the location for external video data if the content is external, otherwise results in the TypeError exception.

Returns:

The location for external video data.

Return type:

str

Raises:

TypeError – If the content is not external.

get_method()

Returns the method for external video data if the content is external, otherwise results in the TypeError exception.

Returns:

The method for external video data.

Return type:

str

Raises:

TypeError – If the content is not external.

static internal(data)
is_external()
is_internal()
is_none()
static none()
class savant_rs.primitives.VideoFrameTranscodingMethod

Represents the structure for accessing primary video content encoding information for the frame.

Copy = VideoFrameTranscodingMethod.Copy
Encoded = VideoFrameTranscodingMethod.Encoded
class savant_rs.primitives.VideoFrameTransformation

Represents the structure for accessing/defining video frame transformation information.

as_initial_size

Returns the transformation as initial size if it is initial size, otherwise None.

Returns:

The transformation as initial size if it is initial size, otherwise None.

Return type:

Optional[Tuple[int, int]]

as_padding

Returns the transformation as padding if it is padding, otherwise None.

Returns:

The transformation as padding if it is padding, otherwise None.

Return type:

Optional[Tuple[int, int, int, int]]

as_resulting_size

Returns the transformation as resulting size if it is resulting size, otherwise None.

Returns:

The transformation as resulting size if it is resulting size, otherwise None.

Return type:

Optional[Tuple[int, int]]

as_scale

Returns the transformation as cloud if it is cloud, otherwise None.

Returns:

The transformation as cloud if it is cloud, otherwise None.

Return type:

Optional[Tuple[int, int]]

static initial_size(width, height)

Defines the size of the frame when it comes into the pipeline.

Parameters:
  • width (int) – The width of the frame.

  • height (int) – The height of the frame.

is_initial_size

Returns true if the transformation is initial size, otherwise false.

Returns:

True if the transformation is initial size, otherwise false.

Return type:

bool

is_padding

Returns true if the transformation is padding, otherwise false.

Returns:

True if the transformation is padding, otherwise false.

Return type:

bool

is_resulting_size

Returns true if the transformation is resulting size, otherwise false.

Returns:

True if the transformation is resulting size, otherwise false.

Return type:

bool

is_scale

Returns true if the transformation is cloud, otherwise false.

Returns:

True if the transformation is cloud, otherwise false.

Return type:

bool

static padding(left, top, right, bottom)

Defines the padding operation on the frame.

Parameters:
  • left (int) – The left padding.

  • top (int) – The top padding.

  • right (int) – The right padding.

  • bottom (int) – The bottom padding.

static resulting_size(width, height)

Defines the size of the frame when it leaves the pipeline.

Parameters:
  • width (int) – The width of the frame.

  • height (int) – The height of the frame.

static scale(width, height)

Defines the cloud operation on the frame.

Parameters:
  • width (int) – The width of the frame.

  • height (int) – The height of the frame.

class savant_rs.primitives.VideoFrameUpdate

A video frame update object is used to update state of a frame from external source.

It contains a list of attributes and a list of objects.

add_frame_attribute(attribute)

Add an attribute to the frame update.

Parameters:

attribute (savant_rs.primitives.Attribute) – The attribute to add

Return type:

None

add_object(object, parent_id=None)

Adds an object to the frame update.

Parameters:
Return type:

None

add_object_attribute(object_id, attribute)

Add an object attribute to the frame update.

Parameters:
frame_attribute_policy

Gets collision resolution policy for attributes

Return type:

savant_rs.primitives.AttributeUpdateCollisionResolutionPolicy

static from_protobuf(bytes, no_gil=True)
json
json_pretty
object_attribute_policy

Gets collision resolution policy for attributes updated on objects

Return type:

savant_rs.primitives.AttributeUpdateCollisionResolutionPolicy

object_policy

Gets collision resolution policy for objects

Return type:

savant_rs.primitives.ObjectUpdateCollisionResolutionPolicy

objects

Returns the list of objects

Returns:

The list of objects and their to-be-assigned parents

Return type:

List[(savant_rs.primitives.VideoObject, Optional[int])]

to_protobuf(no_gil=True)
class savant_rs.primitives.VideoObject(id, namespace, label, detection_box, attributes, confidence=None, track_id=None, track_box=None)
attributes
confidence
detection_box
static from_protobuf(bytes, no_gil=True)
get_attribute(namespace, name)
id
label
namespace
set_attribute(attribute)
set_persistent_attribute(namespace, name, is_hidden, hint=None, values=None)
set_temporary_attribute(namespace, name, is_hidden, hint=None, values=None)
to_protobuf(no_gil=True)
track_box
track_id
class savant_rs.primitives.VideoObjectsView
ids
memory_handle
object_memory_handles
sorted_by_id
track_ids