Table of Contents

Class ObjectAnalyticsBlock

Namespace
VisioForge.Core.MediaBlocks.AI
Assembly
VisioForge.Core.AI.dll

Turnkey MediaBlock that performs multi-object tracking, tripwire line crossing, and polygon zone occupancy on top of ONNX object detection, drawing overlays and raising analytics events.

public sealed class ObjectAnalyticsBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

MediaBlock

Implements

IMediaBlock
IMediaBlockInternals

Inherited Members

MediaBlock.GetPipelineContext()
MediaBlock.SetPipelineContext(BlockPipelineContext)
MediaBlock.SetPipeline(MediaBlocksPipeline)
MediaBlock.Context
MediaBlock.Name
MediaBlock.IsBuilt
MediaBlock.Owner
MediaBlock.Type
MediaBlock.ID
MediaBlock.Input
MediaBlock.Inputs
MediaBlock.Output
MediaBlock.Outputs
MediaBlock.HasInputs
MediaBlock.HasOutputs
MediaBlock.Build()
MediaBlock.CreateElements()
MediaBlock.AddElementsToPipeline()
MediaBlock.RemoveElementsFromPipeline()
MediaBlock.DeepCopy(string)
MediaBlock.Reset()
MediaBlock.ToYAMLBlock()
MediaBlock.ClearPads()
MediaBlock.Dispose()

Constructors

ObjectAnalyticsBlock(ObjectAnalyticsSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.AI.ObjectAnalyticsBlock class.

public ObjectAnalyticsBlock(ObjectAnalyticsSettings settings)

Parameters

settings ObjectAnalyticsSettings

The analytics settings. Must not be null.

Properties

ActiveProvider

Gets the active ONNX execution provider.

public OnnxExecutionProvider ActiveProvider { get; }

Property Value

OnnxExecutionProvider

Input

Gets the primary input pad for this media block.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the collection of input pads for this media block.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

LastAnalyticsTimeMs

Gets the filter + tracker + lines + zones + renderer time of the last processed frame, in milliseconds. Zero before the first frame.

public float LastAnalyticsTimeMs { get; }

Property Value

float

LastInferenceTimeMs

Gets the detector preprocessing + ONNX run + decode time of the last processed frame, in milliseconds. Zero before the first frame.

public float LastInferenceTimeMs { get; }

Property Value

float

Output

Gets the primary output pad for this media block.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the collection of output pads for this media block.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets or sets the functional type of this media block (source, sink, effect, encoder, etc.). This property must be overridden in derived classes to specify the block's role in the pipeline.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Exceptions

NotImplementedException

Thrown when the derived class has not implemented this property.

NotImplementedException

Thrown when the derived class has not implemented the setter.

Methods

Build()

Builds and initializes this media block, creating any necessary GStreamer elements and configuring them. This method must be overridden in derived classes to implement block-specific initialization logic.

public override bool Build()

Returns

bool

true if the block was successfully built; otherwise, false.

CleanUp()

Releases all resources and performs cleanup operations for this MediaBlock. This method disposes of GStreamer elements, releases memory, and ensures proper shutdown of the block. Called automatically during pipeline teardown.

public void CleanUp()

Dispose(bool)

Releases unmanaged and - optionally - managed resources. Override this method in derived classes to implement block-specific cleanup logic.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetCore()

Gets the core GStreamer element wrapped by this block.

public BaseElement GetCore()

Returns

BaseElement

The VisioForge.Core.GStreamer.Base.BaseElement wrapper, or null if not built yet.

GetElement()

Gets the GStreamer element instance.

public Element GetElement()

Returns

Element

The Gst.Element, or null if not built yet.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Associates this MediaBlock with a pipeline and initializes its internal context. This method is called automatically when the block is added to a pipeline, providing access to shared resources and pipeline-wide configuration.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline instance that will manage this block.

OnAnalyticsUpdated

Raised on every processed inference frame with the tracked objects, line crossings, zone snapshots, and source frame timestamp.

public event EventHandler<ObjectAnalyticsEventArgs> OnAnalyticsUpdated

Event Type

EventHandler<ObjectAnalyticsEventArgs>