GStreamer Video Analytics (GVA) Plugin
Public Member Functions | Protected Attributes | List of all members
GVA::RegionOfInterest Class Reference

This class represents region of interest - object describing detection result (bounding box) and containing multiple Tensor objects (inference results) attached by multiple models. For example, it can be region of interest with detected face and recognized age and sex of a person. It can be produced by a pipeline with gvadetect with detection model and two gvaclassify elements with two classification models. Such RegionOfInterest will have bounding box coordinates filled and will have 3 Tensor objects attached - 1 Tensor object with detection result and 2 Tensor objects with classification results coming from 2 classifications. More...

#include <region_of_interest.h>

Collaboration diagram for GVA::RegionOfInterest:
Collaboration graph
[legend]

Public Member Functions

Rect< uint32_t > rect () const
 Get bounding box of the RegionOfInterest as pixel coordinates in original image. More...
 
Rect< double > normalized_rect ()
 Get bounding box of the RegionOfInterest as normalized coordinates in the range [0, 1]. More...
 
std::string label () const
 Get RegionOfInterest label. More...
 
double confidence () const
 Get RegionOfInterest detection confidence (set by gvadetect) More...
 
int32_t object_id () const
 Get unique id of the RegionOfInterest. The id typically created by gvatrack element. More...
 
std::vector< Tensortensors () const
 Get all Tensor instances added to this RegionOfInterest. More...
 
Tensor add_tensor (const std::string &name)
 Add new tensor (inference result) to this RegionOfInterest with name set. To add detection tensor, set name to "detection". More...
 
Tensor detection ()
 Returns detection Tensor, last added to this RegionOfInterest. As any other Tensor, returned detection Tensor can contain arbitrary information. If you use RegionOfInterest based on GstVideoRegionOfInterestMeta attached by gvadetect by default, then this Tensor will contain "label_id", "confidence", "x_min", "x_max", "y_min", "y_max" fields. If RegionOfInterest doesn't have detection Tensor, it will be created in-place. More...
 
int label_id () const
 Get label_id from detection Tensor, last added to this RegionOfInterest. More...
 
 RegionOfInterest (GstVideoRegionOfInterestMeta *meta)
 Construct RegionOfInterest instance from GstVideoRegionOfInterestMeta. After this, RegionOfInterest will obtain all tensors (detection & inference results) from GstVideoRegionOfInterestMeta. More...
 
void set_label (std::string label)
 Set RegionOfInterest label. More...
 
void set_object_id (int32_t id)
 Set object ID. More...
 
GstVideoRegionOfInterestMeta * _meta () const
 Internal function, don't use or use with caution. More...
 

Protected Attributes

GstVideoRegionOfInterestMeta * _gst_meta
 GstVideoRegionOfInterestMeta containing fields filled with detection result (produced by gvadetect element in Gstreamer pipeline) and all the additional tensors, describing detection and other inference results (produced by gvainference, gvadetect, gvaclassify in Gstreamer pipeline)
 
std::vector< Tensor_tensors
 vector of Tensor objects added to this RegionOfInterest (describing detection & inference results), obtained from GstVideoRegionOfInterestMeta
 
Tensor_detection
 last added detection Tensor instance, defined as Tensor with name set to "detection"
 

Detailed Description

This class represents region of interest - object describing detection result (bounding box) and containing multiple Tensor objects (inference results) attached by multiple models. For example, it can be region of interest with detected face and recognized age and sex of a person. It can be produced by a pipeline with gvadetect with detection model and two gvaclassify elements with two classification models. Such RegionOfInterest will have bounding box coordinates filled and will have 3 Tensor objects attached - 1 Tensor object with detection result and 2 Tensor objects with classification results coming from 2 classifications.

Constructor & Destructor Documentation

◆ RegionOfInterest()

GVA::RegionOfInterest::RegionOfInterest ( GstVideoRegionOfInterestMeta *  meta)
inline

Construct RegionOfInterest instance from GstVideoRegionOfInterestMeta. After this, RegionOfInterest will obtain all tensors (detection & inference results) from GstVideoRegionOfInterestMeta.

Parameters
metaGstVideoRegionOfInterestMeta containing bounding box information and tensors

Member Function Documentation

◆ _meta()

GstVideoRegionOfInterestMeta* GVA::RegionOfInterest::_meta ( ) const
inline

Internal function, don't use or use with caution.

Returns
pointer to underlying GstVideoRegionOfInterestMeta

◆ add_tensor()

Tensor GVA::RegionOfInterest::add_tensor ( const std::string &  name)
inline

Add new tensor (inference result) to this RegionOfInterest with name set. To add detection tensor, set name to "detection".

Parameters
namename for the tensor. If name is set to "detection", detection Tensor will be created and set for this RegionOfInterest
Returns
just created Tensor object, which can be filled with tensor information further

◆ confidence()

double GVA::RegionOfInterest::confidence ( ) const
inline

Get RegionOfInterest detection confidence (set by gvadetect)

Returns
last added detection Tensor confidence if exists, otherwise 0.0

◆ detection()

Tensor GVA::RegionOfInterest::detection ( )
inline

Returns detection Tensor, last added to this RegionOfInterest. As any other Tensor, returned detection Tensor can contain arbitrary information. If you use RegionOfInterest based on GstVideoRegionOfInterestMeta attached by gvadetect by default, then this Tensor will contain "label_id", "confidence", "x_min", "x_max", "y_min", "y_max" fields. If RegionOfInterest doesn't have detection Tensor, it will be created in-place.

Returns
detection Tensor, empty if there were no detection Tensor objects added to this RegionOfInterest when this method was called

◆ label()

std::string GVA::RegionOfInterest::label ( ) const
inline

Get RegionOfInterest label.

Returns
RegionOfInterest label

◆ label_id()

int GVA::RegionOfInterest::label_id ( ) const
inline

Get label_id from detection Tensor, last added to this RegionOfInterest.

Returns
last added detection Tensor label_id if exists, otherwise 0

◆ normalized_rect()

Rect<double> GVA::RegionOfInterest::normalized_rect ( )
inline

Get bounding box of the RegionOfInterest as normalized coordinates in the range [0, 1].

Returns
Bounding box coordinates of the RegionOfInterest

◆ object_id()

int32_t GVA::RegionOfInterest::object_id ( ) const
inline

Get unique id of the RegionOfInterest. The id typically created by gvatrack element.

Returns
Unique id, or zero value if not found

◆ rect()

Rect<uint32_t> GVA::RegionOfInterest::rect ( ) const
inline

Get bounding box of the RegionOfInterest as pixel coordinates in original image.

Returns
Bounding box coordinates of the RegionOfInterest

◆ set_label()

void GVA::RegionOfInterest::set_label ( std::string  label)
inline

Set RegionOfInterest label.

Parameters
labelLabel to set

◆ set_object_id()

void GVA::RegionOfInterest::set_object_id ( int32_t  id)
inline

Set object ID.

Parameters
idID to set

◆ tensors()

std::vector<Tensor> GVA::RegionOfInterest::tensors ( ) const
inline

Get all Tensor instances added to this RegionOfInterest.

Returns
vector of Tensor instances added to this RegionOfInterest

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