GStreamer Video Analytics (GVA) Plugin
Public Member Functions | List of all members
gstgva.video_frame.VideoFrame Class Reference

This class represents video frame - object for working with RegionOfInterest and Tensor objects which belong to this video frame (image). More...

Public Member Functions

def __init__ (self, Gst.Buffer buffer, GstVideo.VideoInfo video_info=None, Gst.Caps caps=None)
 Construct VideoFrame instance from Gst.Buffer and GstVideo.VideoInfo or Gst.Caps. More...
 
GstVideo.VideoMeta video_meta (self)
 Get video metadata of buffer. More...
 
GstVideo.VideoInfo video_info (self)
 Get GstVideo.VideoInfo of this VideoFrame. More...
 
def regions (self)
 Get RegionOfInterest objects attached to VideoFrame. More...
 
def tensors (self)
 Get Tensor objects attached to VideoFrame. More...
 
RegionOfInterest add_region (self, x, y, w, h, str label="", float confidence=0.0, bool normalized=False)
 Attach RegionOfInterest to this VideoFrame. More...
 
Tensor add_tensor (self)
 Attach empty Tensor to this VideoFrame. More...
 
List[str] messages (self)
 Get messages attached to this VideoFrame. More...
 
def add_message (self, str message)
 Attach message to this VideoFrame. More...
 
def remove_message (self, str message)
 Remove message from this VideoFrame. More...
 
None remove_region (self, roi)
 Remove region with the specified index. More...
 
numpy.ndarray data (self, Gst.MapFlags flag=Gst.MapFlags.READ)
 Get buffer data wrapped by numpy.ndarray. More...
 

Detailed Description

This class represents video frame - object for working with RegionOfInterest and Tensor objects which belong to this video frame (image).

RegionOfInterest describes detected object (bounding boxes) and its Tensor objects (inference results on RegionOfInterest level). Tensor describes inference results on VideoFrame level. VideoFrame also provides access to underlying GstBuffer and GstVideoInfo describing frame's video information (such as image width, height, channels, strides, etc.). You also can get cv::Mat object representing this video frame.

Constructor & Destructor Documentation

◆ __init__()

def gstgva.video_frame.VideoFrame.__init__ (   self,
Gst.Buffer  buffer,
GstVideo.VideoInfo   video_info = None,
Gst.Caps   caps = None 
)

Construct VideoFrame instance from Gst.Buffer and GstVideo.VideoInfo or Gst.Caps.

The preferred way of creating VideoFrame is to use Gst.Buffer and GstVideo.VideoInfo

Parameters
bufferGst.Buffer to which metadata is attached and retrieved
video_infoGstVideo.VideoInfo containing video information
capsGst.Caps from which video information is obtained

Member Function Documentation

◆ add_message()

def gstgva.video_frame.VideoFrame.add_message (   self,
str  message 
)

Attach message to this VideoFrame.

Parameters
messagemessage to attach to this VideoFrame

◆ add_region()

RegionOfInterest gstgva.video_frame.VideoFrame.add_region (   self,
  x,
  y,
  w,
  h,
str   label = "",
float   confidence = 0.0,
bool   normalized = False 
)

Attach RegionOfInterest to this VideoFrame.

Parameters
xx coordinate of the upper left corner of bounding box
yy coordinate of the upper left corner of bounding box
wbounding box width
hbounding box height
labelobject label
confidencedetection confidence
region_tensorbase tensor for detection Tensor which will be added to this new
normalizedif True, input coordinates are assumed to be normalized (in [0,1] interval). If False, input coordinates are assumed to be expressed in pixels (this is behavior by default)
Returns
new RegionOfInterest instance

◆ add_tensor()

Tensor gstgva.video_frame.VideoFrame.add_tensor (   self)

Attach empty Tensor to this VideoFrame.

Returns
new Tensor instance

◆ data()

numpy.ndarray gstgva.video_frame.VideoFrame.data (   self,
Gst.MapFlags   flag = Gst.MapFlags.READ 
)

Get buffer data wrapped by numpy.ndarray.

Returns
numpy array instance

◆ messages()

List[str] gstgva.video_frame.VideoFrame.messages (   self)

Get messages attached to this VideoFrame.

Returns
messages attached to this VideoFrame

◆ regions()

def gstgva.video_frame.VideoFrame.regions (   self)

Get RegionOfInterest objects attached to VideoFrame.

Returns
iterator of RegionOfInterest objects attached to VideoFrame

◆ remove_message()

def gstgva.video_frame.VideoFrame.remove_message (   self,
str  message 
)

Remove message from this VideoFrame.

Parameters
messagemessage to remove

◆ remove_region()

None gstgva.video_frame.VideoFrame.remove_region (   self,
  roi 
)

Remove region with the specified index.

Parameters
roiRegion to remove

◆ tensors()

def gstgva.video_frame.VideoFrame.tensors (   self)

Get Tensor objects attached to VideoFrame.

Returns
iterator of Tensor objects attached to VideoFrame

◆ video_info()

GstVideo.VideoInfo gstgva.video_frame.VideoFrame.video_info (   self)

Get GstVideo.VideoInfo of this VideoFrame.

This is preferrable way of getting any image information

Returns
GstVideo.VideoInfo of this VideoFrame

◆ video_meta()

GstVideo.VideoMeta gstgva.video_frame.VideoFrame.video_meta (   self)

Get video metadata of buffer.

Returns
GstVideo.VideoMeta of buffer, nullptr if no GstVideo.VideoMeta available

The documentation for this class was generated from the following file: