OpenCV for Unity 3.0.4
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/5.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.Extensions.SourceToMat.IMatSourceEvents Interface Reference

Lifecycle, frame, and error events raised by a IMatSource implementation. More...

Events

Action< string > OnDerivedFrameLayoutChanged
 Occurs after initialization when a derived frame output layout (columns, rows, type) changes without removing the derived frame, on the thread that commits the layout change. Not raised on the first derived layout establishment during IMatSource.InitializeAsync. At invocation, the derived frame's FrameMat matches the committed output layout. Layout-affecting settings updates may commit immediately without waiting for the next IMatSourceTickable.Tick.
 
Action OnDisposed
 Occurs when IDisposable.Dispose or IAsyncDisposable.DisposeAsync completes and the source enters MatSourceState.Destroyed.
 
Action< SourceToMatErrorCode, string > OnErrorOccurred
 Occurs for expected runtime failures with a SourceToMatErrorCode and message, on the thread that detected the failure.
 
Action OnFrameMatLayoutChanged
 Occurs after initialization when the output IMatSource.FrameMat layout (cols, rows, type) changes without a full release cycle, on the thread that commits the layout change. Not raised on the first layout establishment during IMatSource.InitializeAsync. When derived frames are registered, their output buffers are synced to the new primary layout before this event is raised.
 
Action OnFrameMatUpdated
 Occurs at the end of IMatSourceTickable.Tick when IMatSource.DidUpdateThisFrame is true for that tick, after any registered derived frames are evaluated.
 
Action OnInitialized
 Occurs when an initialization cycle completes and playback state (Ready / Playing / Paused) is determined, on the thread that completes the underlying async operation.
 
Action OnReleased
 Occurs when IMatSource.ReleaseAsync completes and the source returns to MatSourceState.Uninitialized, on the thread that completes the underlying async operation.
 

Detailed Description

Lifecycle, frame, and error events raised by a IMatSource implementation.

Not part of IMatSource. Implemented by MatSourceBase. Hosts that bridge lifecycle, frame, and error notifications consume this interface on the concrete source.

Handlers may run on the thread that completes the underlying async operation or detects the failure. Host-owned UI or scene objects should only be touched from the main thread; marshal from the handler when the completion thread may differ. From Unity UI or scene code, prefer helper UnityEvents (main-thread marshaling built in) rather than subscribing to this interface directly.

Event Documentation

◆ OnDerivedFrameLayoutChanged

Action<string> OpenCVForUnity.Extensions.SourceToMat.IMatSourceEvents.OnDerivedFrameLayoutChanged

Occurs after initialization when a derived frame output layout (columns, rows, type) changes without removing the derived frame, on the thread that commits the layout change. Not raised on the first derived layout establishment during IMatSource.InitializeAsync. At invocation, the derived frame's FrameMat matches the committed output layout. Layout-affecting settings updates may commit immediately without waiting for the next IMatSourceTickable.Tick.

◆ OnDisposed

Action OpenCVForUnity.Extensions.SourceToMat.IMatSourceEvents.OnDisposed

Occurs when IDisposable.Dispose or IAsyncDisposable.DisposeAsync completes and the source enters MatSourceState.Destroyed.

Not raised by IMatSource.ReleaseAsync. When the source is initialized and disposed without a prior release, OnReleased is not raised.

On single-threaded hosts (for example browser/WebAssembly targets), product teardown must call IAsyncDisposable.DisposeAsync; do not use IDisposable.Dispose.

◆ OnErrorOccurred

Action<SourceToMatErrorCode, string> OpenCVForUnity.Extensions.SourceToMat.IMatSourceEvents.OnErrorOccurred

Occurs for expected runtime failures with a SourceToMatErrorCode and message, on the thread that detected the failure.

◆ OnFrameMatLayoutChanged

Action OpenCVForUnity.Extensions.SourceToMat.IMatSourceEvents.OnFrameMatLayoutChanged

Occurs after initialization when the output IMatSource.FrameMat layout (cols, rows, type) changes without a full release cycle, on the thread that commits the layout change. Not raised on the first layout establishment during IMatSource.InitializeAsync. When derived frames are registered, their output buffers are synced to the new primary layout before this event is raised.

◆ OnFrameMatUpdated

Action OpenCVForUnity.Extensions.SourceToMat.IMatSourceEvents.OnFrameMatUpdated

Occurs at the end of IMatSourceTickable.Tick when IMatSource.DidUpdateThisFrame is true for that tick, after any registered derived frames are evaluated.

Use this event to consume IMatSource.FrameMat after each successful source grab during playback. For layout-only changes without a new grab, use OnFrameMatLayoutChanged instead.

◆ OnInitialized

Action OpenCVForUnity.Extensions.SourceToMat.IMatSourceEvents.OnInitialized

Occurs when an initialization cycle completes and playback state (Ready / Playing / Paused) is determined, on the thread that completes the underlying async operation.

◆ OnReleased

Action OpenCVForUnity.Extensions.SourceToMat.IMatSourceEvents.OnReleased

Occurs when IMatSource.ReleaseAsync completes and the source returns to MatSourceState.Uninitialized, on the thread that completes the underlying async operation.

Raised when IMatSource.ReleaseAsync completes, including when initialization was in progress (MatSourceState.Initializing) and before OnInitialized was raised. Does not imply IMatSource.FrameMat was valid; handlers must not assume a prior successful initialization.

Not raised when initialization fails without a release request (OnErrorOccurred instead). Not raised by IDisposable.Dispose or IAsyncDisposable.DisposeAsync (see OnDisposed).


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