OpenCV for Unity  2.6.2
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.
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
OpenCVForUnity.UnityUtils.Helper.Image2MatHelper Class Reference

Image 2 mat helper. v 1.0.0 More...

Inheritance diagram for OpenCVForUnity.UnityUtils.Helper.Image2MatHelper:
OpenCVForUnity.UnityUtils.Helper.IImageSource2MatHelper OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper

Public Member Functions

virtual void Initialize (bool autoPlay=true)
 Initialize this instance. More...
 
virtual void Initialize (string requestedImageFilePath, bool autoPlay=true)
 Initialize this instance. More...
 
virtual bool IsInitialized ()
 Indicate whether this instance has been initialized. More...
 
virtual void Play ()
 Start the image. More...
 
virtual void Pause ()
 Pause the image. More...
 
virtual void Stop ()
 Stop the image. More...
 
virtual bool IsPlaying ()
 Indicate whether the image is currently playing. More...
 
virtual bool IsPaused ()
 Indicate whether the image is paused. More...
 
virtual string GetDeviceName ()
 Return the active image device name. More...
 
virtual int GetWidth ()
 Return the image width. More...
 
virtual int GetHeight ()
 Return the image height. More...
 
virtual Source2MatHelperColorFormat GetBaseColorFormat ()
 Return the image base color format. More...
 
virtual bool DidUpdateThisFrame ()
 Indicate whether the image buffer of the frame has been updated. More...
 
virtual Mat GetMat ()
 Get 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). More...
 
virtual void Dispose ()
 Releases all resource used by the Image2MatHelper object. More...
 

Protected Member Functions

virtual void OnValidate ()
 
virtual void LateUpdate ()
 
virtual void OnDestroy ()
 Raises the destroy event. More...
 
virtual IEnumerator _Initialize ()
 Initialize this instance by coroutine. More...
 
virtual void StartWaitFrameTimeThread ()
 
virtual void StopWaitFrameTimeThread ()
 
virtual IEnumerator WaitFrameTimeThreadWorker ()
 
virtual void CancelInitCoroutine ()
 Cancel Init Coroutine. More...
 
virtual void ReleaseResources ()
 To release the resources. More...
 

Protected Attributes

string _requestedImageFilePath = string.Empty
 Set the image file path, relative to the starting point of the "StreamingAssets" folder, or absolute path. More...
 
Source2MatHelperColorFormat _outputColorFormat = Source2MatHelperColorFormat.BGR
 Select the output color format. More...
 
int _timeoutFrameCount = 1500
 The number of frames before the initialization process times out. More...
 
bool _repeat = true
 Indicate whether to play this image in a repeat. More...
 
UnityEvent _onInitialized
 UnityEvent that is triggered when this instance is initialized. More...
 
UnityEvent _onDisposed
 UnityEvent that is triggered when this instance is disposed. More...
 
Source2MatHelperErrorUnityEvent _onErrorOccurred
 UnityEvent that is triggered when this instance is error Occurred. More...
 
bool isPlaying = false
 
bool didUpdateThisFrame = false
 
bool didUpdateImageBufferInCurrentFrame = false
 
Mat frameMat
 The frame mat. More...
 
Source2MatHelperColorFormat baseColorFormat = Source2MatHelperColorFormat.BGR
 The base color format. More...
 
bool isInitWaiting = false
 Indicates whether this instance is waiting for initialization to complete. More...
 
bool hasInitDone = false
 Indicates whether this instance has been initialized. More...
 
IEnumerator initCoroutine
 The initialization coroutine. More...
 
IEnumerator getFilePathCoroutine
 The get file path coroutine. More...
 
string imageFileFullPath
 
IEnumerator waitFrameTimeCoroutine
 The wait frame time coroutine. More...
 
bool isThreadRunning = false
 
bool shouldStopThread = false
 
bool autoPlayAfterInitialize
 If set to true play after completion of initialization. More...
 

Properties

virtual string requestedImageFilePath [get, set]
 
virtual Source2MatHelperColorFormat outputColorFormat [get, set]
 
virtual int timeoutFrameCount [get, set]
 
virtual bool repeat [get, set]
 
UnityEvent onInitialized [get, set]
 
UnityEvent onDisposed [get, set]
 
Source2MatHelperErrorUnityEvent onErrorOccurred [get, set]
 
- Properties inherited from OpenCVForUnity.UnityUtils.Helper.IImageSource2MatHelper
string requestedImageFilePath [get, set]
 
bool repeat [get, set]
 
- Properties inherited from OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper
Source2MatHelperColorFormat outputColorFormat [get, set]
 
int timeoutFrameCount [get, set]
 
UnityEvent onInitialized [get, set]
 
UnityEvent onDisposed [get, set]
 
Source2MatHelperErrorUnityEvent onErrorOccurred [get, set]
 

Detailed Description

Image 2 mat helper. v 1.0.0

By setting outputColorFormat to GRAY or BGR, processing that does not include extra color conversion is performed.

Member Function Documentation

◆ _Initialize()

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

Initialize this instance by coroutine.

◆ CancelInitCoroutine()

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

Cancel Init Coroutine.

◆ DidUpdateThisFrame()

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

Indicate whether the image buffer of the frame has been updated.

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

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Dispose()

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

Releases all resource used by the Image2MatHelper object.

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

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetBaseColorFormat()

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

Return the image base color format.

Returns
The image base color format.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetDeviceName()

virtual string OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.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.Image2MatHelper.GetHeight ( )
virtual

Return the image height.

Returns
The image height.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetMat()

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

Get 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.

◆ GetWidth()

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

Return the image width.

Returns
The image width.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Initialize() [1/2]

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

Initialize 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.Image2MatHelper.Initialize ( string  requestedImageFilePath,
bool  autoPlay = true 
)
virtual

Initialize this instance.

Parameters
requestedImageFilePathRequested image file path.
autoPlayIf set to true play after completion of initialization.

◆ IsInitialized()

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

Indicate 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.Image2MatHelper.IsPaused ( )
virtual

Indicate whether the image is paused.

Returns
true, if the image is paused, false otherwise.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ IsPlaying()

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

Indicate whether the image is currently playing.

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

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ LateUpdate()

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

◆ OnDestroy()

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

Raises the destroy event.

◆ OnValidate()

virtual void OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.OnValidate ( )
protectedvirtual

◆ Pause()

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

◆ Play()

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

◆ ReleaseResources()

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

To release the resources.

◆ StartWaitFrameTimeThread()

virtual void OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.StartWaitFrameTimeThread ( )
protectedvirtual

◆ Stop()

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

◆ StopWaitFrameTimeThread()

virtual void OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.StopWaitFrameTimeThread ( )
protectedvirtual

◆ WaitFrameTimeThreadWorker()

virtual IEnumerator OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.WaitFrameTimeThreadWorker ( )
protectedvirtual

Member Data Documentation

◆ _onDisposed

UnityEvent OpenCVForUnity.UnityUtils.Helper.Image2MatHelper._onDisposed
protected

UnityEvent that is triggered when this instance is disposed.

◆ _onErrorOccurred

Source2MatHelperErrorUnityEvent OpenCVForUnity.UnityUtils.Helper.Image2MatHelper._onErrorOccurred
protected

UnityEvent that is triggered when this instance is error Occurred.

◆ _onInitialized

UnityEvent OpenCVForUnity.UnityUtils.Helper.Image2MatHelper._onInitialized
protected

UnityEvent that is triggered when this instance is initialized.

◆ _outputColorFormat

Source2MatHelperColorFormat OpenCVForUnity.UnityUtils.Helper.Image2MatHelper._outputColorFormat = Source2MatHelperColorFormat.BGR
protected

Select the output color format.

◆ _repeat

bool OpenCVForUnity.UnityUtils.Helper.Image2MatHelper._repeat = true
protected

Indicate whether to play this image in a repeat.

◆ _requestedImageFilePath

string OpenCVForUnity.UnityUtils.Helper.Image2MatHelper._requestedImageFilePath = string.Empty
protected

Set the image file path, relative to the starting point of the "StreamingAssets" folder, or absolute path.

◆ _timeoutFrameCount

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

The number of frames before the initialization process times out.

◆ autoPlayAfterInitialize

bool OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.autoPlayAfterInitialize
protected

If set to true play after completion of initialization.

◆ baseColorFormat

Source2MatHelperColorFormat OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.baseColorFormat = Source2MatHelperColorFormat.BGR
protected

The base color format.

◆ didUpdateImageBufferInCurrentFrame

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

◆ didUpdateThisFrame

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

◆ frameMat

Mat OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.frameMat
protected

The frame mat.

◆ getFilePathCoroutine

IEnumerator OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.getFilePathCoroutine
protected

The get file path coroutine.

◆ hasInitDone

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

Indicates whether this instance has been initialized.

◆ imageFileFullPath

string OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.imageFileFullPath
protected

◆ initCoroutine

IEnumerator OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.initCoroutine
protected

The initialization coroutine.

◆ isInitWaiting

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

Indicates whether this instance is waiting for initialization to complete.

◆ isPlaying

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

◆ isThreadRunning

bool OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.isThreadRunning = false
protected

◆ shouldStopThread

bool OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.shouldStopThread = false
protected

◆ waitFrameTimeCoroutine

IEnumerator OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.waitFrameTimeCoroutine
protected

The wait frame time coroutine.

Property Documentation

◆ onDisposed

UnityEvent OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.onDisposed
getset

◆ onErrorOccurred

Source2MatHelperErrorUnityEvent OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.onErrorOccurred
getset

◆ onInitialized

UnityEvent OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.onInitialized
getset

◆ outputColorFormat

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

◆ repeat

virtual bool OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.repeat
getset

◆ requestedImageFilePath

virtual string OpenCVForUnity.UnityUtils.Helper.Image2MatHelper.requestedImageFilePath
getset

◆ timeoutFrameCount

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

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