OpenCV for Unity 2.6.3
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper Class Reference

AsyncGPUReadback 2 mat helper. v 1.0.1. More...

Inheritance diagram for OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper:
OpenCVForUnity.UnityUtils.Helper.ITextureSource2MatHelper OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper

Public Member Functions

virtual void Initialize (bool autoPlay=true)
 Initializes this instance.
 
virtual void Initialize (Texture sourceTexture, bool autoPlay=true)
 Initialize this instance.
 
virtual bool IsInitialized ()
 Indicates whether this instance has been initialized.
 
virtual void Play ()
 Starts the readback.
 
virtual void Pause ()
 Pauses the readback.
 
virtual void Stop ()
 Stops the readback.
 
virtual bool IsPlaying ()
 Indicates whether the readback is currently playing.
 
virtual bool IsPaused ()
 Indicates whether the readback is paused.
 
virtual string GetDeviceName ()
 Return the active image device name.
 
virtual int GetWidth ()
 Returns the readback buffer width.
 
virtual int GetHeight ()
 Returns the readback buffer height.
 
virtual Source2MatHelperColorFormat GetBaseColorFormat ()
 Returns the readback buffer base color format.
 
virtual Texture GetSourceTexture ()
 Returns the Source Texture.
 
virtual bool DidUpdateThisFrame ()
 Indicates whether the readback buffer of the frame has been updated.
 
virtual Mat GetMat ()
 Gets the mat of the current frame. The Mat object's type is 'CV_8UC4' or 'CV_8UC3' or 'CV_8UC1' (ColorFormat is determined by the outputColorFormat setting).
 
virtual void Dispose ()
 Releases all resource used by the AsyncGPUReadback2MatHelper object.
 
- Public Member Functions inherited from OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper

Protected Member Functions

virtual void Update ()
 
virtual void LateUpdate ()
 
virtual void OnDestroy ()
 Raises the destroy event.
 
virtual IEnumerator _Initialize ()
 Initializes this instance by coroutine.
 
virtual void CancelInitCoroutine ()
 Cancel Init Coroutine.
 
virtual void ReleaseResources ()
 To release the resources.
 

Protected Attributes

Texture _sourceTexture
 Set the source texture.
 
Source2MatHelperColorFormat _outputColorFormat = Source2MatHelperColorFormat.RGBA
 Select the output color format.
 
int _timeoutFrameCount = 1500
 The number of frames before the initialization process times out.
 
UnityEvent _onInitialized
 UnityEvent that is triggered when this instance is initialized.
 
UnityEvent _onDisposed
 UnityEvent that is triggered when this instance is disposed.
 
Source2MatHelperErrorUnityEvent _onErrorOccurred
 UnityEvent that is triggered when this instance is error Occurred.
 
bool didUpdateThisFrame = false
 
bool didUpdateImageBufferInCurrentFrame = false
 
Texture2D texture
 The texture.
 
Mat frameMat
 The frame mat.
 
Mat baseMat
 The base mat.
 
bool useAsyncGPUReadback
 The useAsyncGPUReadback.
 
Source2MatHelperColorFormat baseColorFormat = Source2MatHelperColorFormat.RGBA
 The base color format.
 
bool isInitWaiting = false
 Indicates whether this instance is waiting for initialization to complete.
 
bool hasInitDone = false
 Indicates whether this instance has been initialized.
 
IEnumerator initCoroutine
 The initialization coroutine.
 
bool isPlaying = false
 Indicates whether this instance has been initialized.
 
bool autoPlayAfterInitialize
 If set to true play after completion of initialization.
 

Properties

virtual Texture sourceTexture [get, set]
 
virtual Source2MatHelperColorFormat outputColorFormat [get, set]
 
virtual int timeoutFrameCount [get, set]
 
UnityEvent onInitialized [get, set]
 
UnityEvent onDisposed [get, set]
 
Source2MatHelperErrorUnityEvent onErrorOccurred [get, set]
 
- Properties inherited from OpenCVForUnity.UnityUtils.Helper.ITextureSource2MatHelper
- Properties inherited from OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper

Detailed Description

AsyncGPUReadback 2 mat helper. v 1.0.1.

Efficiently process the conversion to Mat format for Texture classes for which the GetPixels method cannot be used, such as RenderTexture and external texture format Texture2D.

By setting outputColorFormat to RGBA processing that does not include extra color conversion is performed.

Member Function Documentation

◆ _Initialize()

virtual IEnumerator OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper._Initialize ( )
protectedvirtual

Initializes this instance by coroutine.

◆ CancelInitCoroutine()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.CancelInitCoroutine ( )
protectedvirtual

Cancel Init Coroutine.

◆ DidUpdateThisFrame()

virtual bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.DidUpdateThisFrame ( )
virtual

Indicates whether the readback buffer of the frame has been updated.

Returns
true, if the readback buffer has been updated false otherwise.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Dispose()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.Dispose ( )
virtual

Releases all resource used by the AsyncGPUReadback2MatHelper object.

Call Dispose when you are finished using the AsyncGPUReadback2MatHelper. The Dispose method leaves the AsyncGPUReadback2MatHelper in an unusable state. After calling Dispose, you must release all references to the AsyncGPUReadback2MatHelper so the garbage collector can reclaim the memory that the AsyncGPUReadback2MatHelper was occupying.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetBaseColorFormat()

virtual Source2MatHelperColorFormat OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.GetBaseColorFormat ( )
virtual

Returns the readback buffer base color format.

Returns
The readback buffer base color format.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetDeviceName()

virtual string OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.GetDeviceName ( )
virtual

Return the active image device name.

Returns
The active image device name.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetHeight()

virtual int OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.GetHeight ( )
virtual

Returns the readback buffer height.

Returns
The readback buffer height.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetMat()

virtual Mat OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.GetMat ( )
virtual

Gets the mat of the current frame. The Mat object's type is 'CV_8UC4' or 'CV_8UC3' or 'CV_8UC1' (ColorFormat is determined by the outputColorFormat setting).

Returns
The mat of the current frame.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetSourceTexture()

virtual Texture OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.GetSourceTexture ( )
virtual

Returns the Source Texture.

Returns
The Source Texture.

◆ GetWidth()

virtual int OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.GetWidth ( )
virtual

Returns the readback buffer width.

Returns
The readback buffer width.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Initialize() [1/2]

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.Initialize ( bool autoPlay = true)
virtual

Initializes this instance.

Parameters
autoPlayIf set to true play after completion of initialization.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Initialize() [2/2]

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.Initialize ( Texture sourceTexture,
bool autoPlay = true )
virtual

Initialize this instance.

Parameters
sourceTextureSource Texture.
autoPlayIf set to true play after completion of initialization.

◆ IsInitialized()

virtual bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.IsInitialized ( )
virtual

Indicates whether this instance has been initialized.

Returns
true, if this instance has been initialized, false otherwise.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ IsPaused()

virtual bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.IsPaused ( )
virtual

Indicates whether the readback is paused.

Returns
true, if the readback is playing, false otherwise.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ IsPlaying()

virtual bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.IsPlaying ( )
virtual

Indicates whether the readback is currently playing.

Returns
true, if the readback is playing, false otherwise.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ LateUpdate()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.LateUpdate ( )
protectedvirtual

◆ OnDestroy()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.OnDestroy ( )
protectedvirtual

Raises the destroy event.

◆ Pause()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.Pause ( )
virtual

Pauses the readback.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Play()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.Play ( )
virtual

Starts the readback.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ ReleaseResources()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.ReleaseResources ( )
protectedvirtual

To release the resources.

◆ Stop()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.Stop ( )
virtual

Stops the readback.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Update()

virtual void OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.Update ( )
protectedvirtual

Member Data Documentation

◆ _onDisposed

UnityEvent OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper._onDisposed
protected

UnityEvent that is triggered when this instance is disposed.

◆ _onErrorOccurred

Source2MatHelperErrorUnityEvent OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper._onErrorOccurred
protected

UnityEvent that is triggered when this instance is error Occurred.

◆ _onInitialized

UnityEvent OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper._onInitialized
protected

UnityEvent that is triggered when this instance is initialized.

◆ _outputColorFormat

Source2MatHelperColorFormat OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper._outputColorFormat = Source2MatHelperColorFormat.RGBA
protected

Select the output color format.

◆ _sourceTexture

Texture OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper._sourceTexture
protected

Set the source texture.

◆ _timeoutFrameCount

int OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper._timeoutFrameCount = 1500
protected

The number of frames before the initialization process times out.

◆ autoPlayAfterInitialize

bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.autoPlayAfterInitialize
protected

If set to true play after completion of initialization.

◆ baseColorFormat

Source2MatHelperColorFormat OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.baseColorFormat = Source2MatHelperColorFormat.RGBA
protected

The base color format.

◆ baseMat

Mat OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.baseMat
protected

The base mat.

◆ didUpdateImageBufferInCurrentFrame

bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.didUpdateImageBufferInCurrentFrame = false
protected

◆ didUpdateThisFrame

bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.didUpdateThisFrame = false
protected

◆ frameMat

Mat OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.frameMat
protected

The frame mat.

◆ hasInitDone

bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.hasInitDone = false
protected

Indicates whether this instance has been initialized.

◆ initCoroutine

IEnumerator OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.initCoroutine
protected

The initialization coroutine.

◆ isInitWaiting

bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.isInitWaiting = false
protected

Indicates whether this instance is waiting for initialization to complete.

◆ isPlaying

bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.isPlaying = false
protected

Indicates whether this instance has been initialized.

◆ texture

Texture2D OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.texture
protected

The texture.

◆ useAsyncGPUReadback

bool OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.useAsyncGPUReadback
protected

The useAsyncGPUReadback.

Property Documentation

◆ onDisposed

UnityEvent OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.onDisposed
getset

◆ onErrorOccurred

Source2MatHelperErrorUnityEvent OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.onErrorOccurred
getset

◆ onInitialized

UnityEvent OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.onInitialized
getset

◆ outputColorFormat

virtual Source2MatHelperColorFormat OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.outputColorFormat
getset

◆ sourceTexture

virtual Texture OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.sourceTexture
getset

◆ timeoutFrameCount

virtual int OpenCVForUnity.UnityUtils.Helper.AsyncGPUReadback2MatHelper.timeoutFrameCount
getset

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