Skip to content

Latest commit

 

History

History
187 lines (149 loc) · 8.53 KB

api-segvisual.md

File metadata and controls

187 lines (149 loc) · 8.53 KB

Segmentation Visualizer API Reference

The Segmentation Visualizer visualizes segmentation results produced from either a Primary Gst Inference Engine (PGIE) or Primary Triton Inference Server (TIS).

From Nivida's Gst-nvsegvisual plugin documentation. "Segmentation is based on image recognition, except that the classifications occur at the pixel level as opposed to the image level as with image recognition." Please refer to the plugin manual for more information.

Segmentation Visualizer Construction and Destruction

Segmentation Visualizers are created by calling the constructor dsl_segvisual_new. Segmentation Visualizers are deleted by calling dsl_component_delete, dsl_component_delete_many, or dsl_component_delete_all

Adding to a Pipeline

The relationship between Pipelines/Branches and Segmentation Visualizers is one-to-one. Once added to a Pipeline or Branch, a Segmentation Visualizer must be removed before it can used with another.

Segmentation Visualizers are added to a Pipeline by calling dsl_pipeline_component_add or dsl_pipeline_component_add_many (when adding with other components) and removed with dsl_pipeline_component_remove, dsl_pipeline_component_remove_many, or dsl_pipeline_component_remove_all.

Adding to a Branch

Segmentation Visualizers are added to Branches by calling dsl_branch_component_add or dsl_branch_component_add_many (when adding with other components) and removed with dsl_branch_component_remove, dsl_branch_component_remove_many, or dsl_branch_component_remove_all.

Adding/Removing Pad-Probe-handlers

Multiple Source Pad-Probe Handlers can be added to a Segmentation Visualizer by calling dsl_segvisual_pph_add and removed with dsl_segvisual_pph_remove.

Relevant Examples

Segmentation Visualizer API

Constructors

Methods

Return Values

The following return codes are used by the Segmentation Visualizer API

#define DSL_RESULT_SEGVISUAL_RESULT                                 0x00600000
#define DSL_RESULT_SEGVISUAL_NAME_NOT_UNIQUE                        0x00600001
#define DSL_RESULT_SEGVISUAL_NAME_NOT_FOUND                         0x00600002
#define DSL_RESULT_SEGVISUAL_THREW_EXCEPTION                        0x00600003
#define DSL_RESULT_SEGVISUAL_IN_USE                                 0x00600004
#define DSL_RESULT_SEGVISUAL_SET_FAILED                             0x00600005
#define DSL_RESULT_SEGVISUAL_PARAMETER_INVALID                      0x00600006
#define DSL_RESULT_SEGVISUAL_HANDLER_ADD_FAILED                     0x00600007
#define DSL_RESULT_SEGVISUAL_HANDLER_REMOVE_FAILED                  0x00600008

Constructors

dsl_segvisual_new

DslReturnType dsl_segvisual_new(const wchar_t* name, uint width, uint height);

The constructor creates a uniquely named Segmentation Visualizer with given output dimensions. Construction will fail if the name is currently in use. The Segmentation Visualizer requires either a Primary Gst Inference Engine (GIE) or Primary Triton Inference Server (TIS) configured with an industrial or semantic segmentation configuration file.

Parameters

  • name - [in] unique name for the Segmentation Visualizer to create.
  • width - [in] output width of the Visualizer in pixels
  • height - [in] output height of the Visualizer in pixels

Returns

  • DSL_RESULT_SUCCESS on successful creation. One of the Return Values defined above on failure

Python Example

retval = dsl_segvisual_new('my-segvisual', 512, 512)

Methods

dsl_segvisual_dimensions_get

DslReturnType dsl_segvisual_dimensions_get(const wchar_t* name,
    uint* width, uint* height);

This service returns the current width and height of the named Segmentation Visualizer.

Parameters

  • name - [in] unique name for the Segmentation Visualizer to query.
  • width - [out] width of the Visualizer in pixels.
  • height - [out] height of the Visualizer in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful query. One of the Return Values defined above on failure

Python Example

retval, width, height = dsl_segvisual_dimensions_get('my-segvisual')

dsl_segvisual_dimensions_set

DslReturnType dsl_segvisual_dimensions_set(const wchar_t* name,
    uint width, uint height);

This service sets the width and height of the named Segmentation Visualizer.

Parameters

  • name - [in] unique name for the Segmentation Visualizer to update.
  • width - [in] new output width for the Visualizer in pixels.
  • height - [in] new output height for the Visualizer in pixels.

Returns

  • DSL_RESULT_SUCCESS on successful update. One of the Return Values defined above on failure

Python Example

retval = dsl_segvisual_dimensions_set('my-segvisual', 512, 512)

dsl_segvisual_pph_add

DslReturnType dsl_segvisual_pph_add(const wchar_t* name, const wchar_t* handler);

This service adds a Pad Probe Handler to the Source pad (only) of the named Segmentation Visualizer.

Parameters

  • name - [in] unique name of the Segmentation Visualizer to update.
  • handler - [in] unique name of Pad Probe Handler to add

Returns

  • DSL_RESULT_SUCCESS on successful add. One of the Return Values defined above on failure.

Python Example

retval = dsl_segvisual_pph_add('my-segvisual', 'my-pph-handler')

dsl_segvisual_pph_remove

DslReturnType dsl_segvisual_pph_remove(const wchar_t* name, const wchar_t* handler);

This service removes a Pad Probe Handler from the Source pad of the named Segmentation Visualizer. The service will fail if the named handler is not owned by the Segmentation Visualizer

Parameters

  • name - [in] unique name of the Segmentation Visualizer to update.
  • handler - [in] unique name of Pad Probe Handler to remove

Returns

  • DSL_RESULT_SUCCESS on successful remove. One of the Return Values defined above on failure.

Python Example

retval = dsl_segvisual_pph_remove('my-segvisual', 'my-pph-handler')


API Reference