Class VProcessor
- Namespace
- VisioForge.Core.VAP
- Assembly
- VisioForge.Core.dll
Provides video processing capabilities using the VisioForge Video Analysis Platform (VAP).
public class VProcessor : IDisposableInheritance
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
contextBaseContext-
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
disposingbool-
If set to
true, releases both managed and unmanaged resources; iffalse, 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
widthint-
The width of the video frame in pixels.
heightint-
The height of the video frame in pixels.
strideint-
The stride (row pitch) of the video frame in bytes.
filterstring-
The name of the filter to be applied to video frames.
parametersstring-
The configuration parameters for the specified filter.
useHardwarebool-
If set to
true, enables hardware acceleration for video processing when available.
Returns
- bool
-
trueif initialization is successful;falseotherwise.
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
widthint-
The width of the video frame in pixels.
heightint-
The height of the video frame in pixels.
strideint-
The stride (row pitch) of the video frame in bytes.
datanint-
A pointer to the video frame data buffer. The frame data is modified in-place.
Returns
- bool
-
trueif the frame is processed successfully;falseotherwise.
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
videoFrameVideoFrameX-
The video frame object containing the frame data and metadata.
Returns
- bool
-
trueif the frame is processed successfully;falseotherwise.
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
namestring-
The name of the filter parameter to update.
valuestring-
The new value for the specified parameter.
Returns
- bool
-
trueif the parameter was successfully updated;falseotherwise.
Remarks
This method allows real-time adjustment of filter parameters during video processing without interrupting the processing pipeline.