Table of Contents

Class VProcessor

Namespace
VisioForge.Core.VAP
Assembly
VisioForge.Core.dll

Provides video processing capabilities using the VisioForge Video Analysis Platform (VAP).

public class VProcessor : IDisposable

Inheritance

Implements

Inherited Members

Remarks

The VProcessor class wraps native video processing functionality and supports: - Real-time video frame processing with configurable filters - Hardware acceleration support - Cross-platform operation (Windows, macOS, Linux, Android) - Dynamic filter parameter updates

This class implements IDisposable and must be properly disposed to release native resources.

Constructors

VProcessor(BaseContext)

Initializes a new instance of the VisioForge.Core.VAP.VProcessor class.

public VProcessor(BaseContext context)

Parameters

context BaseContext

The base context for logging and error reporting. Can be null if logging is not required.

Methods

Dispose(bool)

Releases the unmanaged and optionally the managed resources used by the VisioForge.Core.VAP.VProcessor class.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

If set to true, releases both managed and unmanaged resources; if false, releases only unmanaged resources.

Remarks

This method is called by both the VisioForge.Core.VAP.VProcessor.Dispose(System.Boolean) method and the finalizer. When called from Dispose (disposing = true), it releases both managed and unmanaged resources. When called from the finalizer (disposing = false), it releases only unmanaged resources.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Remarks

This method destroys the native video processor instance and releases all associated resources. After calling Dispose, the processor instance cannot be reused.

This method implements the IDisposable pattern and should be called when the processor is no longer needed. Consider using a 'using' statement to ensure proper disposal.

~VProcessor()

Finalizes an instance of the VisioForge.Core.VAP.VProcessor class and releases unmanaged resources.

protected ~VProcessor()

Remarks

This destructor is called by the garbage collector during finalization. It ensures that native resources are released even if Dispose is not called explicitly. For better performance, always call Dispose explicitly when done with the processor.

Init(int, int, int, string, string, bool)

Initializes the video processor with the specified parameters.

public bool Init(int width, int height, int stride, string filter, string parameters, bool useHardware)

Parameters

width int

The width of the video frame in pixels.

height int

The height of the video frame in pixels.

stride int

The stride (row pitch) of the video frame in bytes.

filter string

The name of the filter to be applied to video frames.

parameters string

The configuration parameters for the specified filter.

useHardware bool

If set to true, enables hardware acceleration for video processing when available.

Returns

bool

true if initialization is successful; false otherwise.

Remarks

This method must be called before processing any frames. It creates the native processor instance, configures error logging, and initializes the video processing pipeline with the specified parameters.

If initialization fails, the processor automatically cleans up any allocated resources.

Exceptions

InvalidOperationException

Thrown if the native video processor instance cannot be created.

ProcessFrame(int, int, int, nint)

Processes a video frame with the configured filter.

public bool ProcessFrame(int width, int height, int stride, nint data)

Parameters

width int

The width of the video frame in pixels.

height int

The height of the video frame in pixels.

stride int

The stride (row pitch) of the video frame in bytes.

data nint

A pointer to the video frame data buffer. The frame data is modified in-place.

Returns

bool

true if the frame is processed successfully; false otherwise.

Remarks

If the frame dimensions differ from the initialized dimensions, the processor automatically reinitializes with the new dimensions using the same filter and parameters.

The frame data is expected to be in RGB format and is modified in-place.

Exceptions

ObjectDisposedException

Thrown if the processor has been disposed.

ProcessFrame(VideoFrameX)

Processes a video frame using a VisioForge.Core.Types.X.VideoFrameX object.

public bool ProcessFrame(VideoFrameX videoFrame)

Parameters

videoFrame VideoFrameX

The video frame object containing the frame data and metadata.

Returns

bool

true if the frame is processed successfully; false otherwise.

Remarks

This is a convenience overload that extracts width, height, stride, and data pointer from the VisioForge.Core.Types.X.VideoFrameX object and calls the main ProcessFrame method.

UpdateFilterParameters(string, string)

Updates filter parameters dynamically without reinitializing the processor.

public bool UpdateFilterParameters(string name, string value)

Parameters

name string

The name of the filter parameter to update.

value string

The new value for the specified parameter.

Returns

bool

true if the parameter was successfully updated; false otherwise.

Remarks

This method allows real-time adjustment of filter parameters during video processing without interrupting the processing pipeline.