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 Types | Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper Class Reference

MultiSource 2 mat helper. v 1.0.0 More...

Inheritance diagram for OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper:
OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper

Public Types

enum  MultiSource2MatHelperClassName : int {
  MultiSource2MatHelperClassName.WebCamTexture2MatHelper = 0, MultiSource2MatHelperClassName.VideoCapture2MatHelper, MultiSource2MatHelperClassName.UnityVideoPlayer2MatHelper, MultiSource2MatHelperClassName.Image2MatHelper,
  MultiSource2MatHelperClassName.CustomSource2MatHelper
}
 
enum  MultiSource2MatHelperClassCategory : int { MultiSource2MatHelperClassCategory.Camera = 0, MultiSource2MatHelperClassCategory.Video, MultiSource2MatHelperClassCategory.Image, MultiSource2MatHelperClassCategory.Custom }
 

Public Member Functions

virtual MultiSource2MatHelperClassName GetCurrentSource2MatHelperClassName ()
 
virtual void Initialize (bool autoPlay=true)
 Initialize this instance. More...
 
virtual bool IsInitialized ()
 Indicate whether this instance has been initialized. More...
 
virtual void Play ()
 Start the source device. More...
 
virtual void Pause ()
 Pause the source device. More...
 
virtual void Stop ()
 Stop the source device. More...
 
virtual bool IsPlaying ()
 Indicate whether the source device is currently playing. More...
 
virtual bool IsPaused ()
 Indicate whether the device is paused. More...
 
virtual string GetDeviceName ()
 Return the source device name. More...
 
virtual int GetWidth ()
 Return the source width. More...
 
virtual int GetHeight ()
 Return the source height. More...
 
virtual Source2MatHelperColorFormat GetBaseColorFormat ()
 Return the source base color format. More...
 
virtual bool DidUpdateThisFrame ()
 Indicate whether the source 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). Please do not dispose of the returned mat as it will be reused. More...
 
virtual void Dispose ()
 

Protected Member Functions

virtual void OnValidate ()
 
virtual MultiSource2MatHelperClassCategory ClassNameToClassCategory (MultiSource2MatHelperClassName className)
 

Protected Attributes

ISource2MatHelper _source2MatHelper
 
MultiSource2MatHelperClassName _requestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatHelper
 Select the source to mat helper class name. If CustomSource2MatHelper is selected, only the UnityEvent inspector is overridden for the custom helper class component. More...
 
MultiSource2MatHelperClassName _currentSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatHelper
 
MultiSource2MatHelperClassCategory _currentSource2MatHelperClassCategory = MultiSource2MatHelperClassCategory.Camera
 
string _requestedDeviceName = null
 Set the name of the camera device to use. (or device index number) More...
 
int _requestedWidth = 640
 Set the width of camera. More...
 
int _requestedHeight = 480
 Set the height of camera. More...
 
bool _requestedIsFrontFacing = false
 Set whether to use the front facing camera. More...
 
float _requestedFPS = 30f
 Set the frame rate of camera. More...
 
string _requestedVideoFilePath = string.Empty
 Set the video file path, relative to the starting point of the "StreamingAssets" folder, or absolute path. More...
 
bool _loop = true
 Indicate whether to play this video in a loop. More...
 
string _requestedImageFilePath = string.Empty
 Set the image file path, relative to the starting point of the "StreamingAssets" folder, or absolute path. More...
 
bool _repeat = true
 Indicate whether to play this image in a repeat. More...
 
Component _customClassComponent = null
 Set the custom class <ISource2MatHelper> component. More...
 
Source2MatHelperColorFormat _outputColorFormat = Source2MatHelperColorFormat.RGBA
 Select the output color format. More...
 
int _timeoutFrameCount = 1500
 The number of frames before the initialization process times out. 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...
 

Properties

ISource2MatHelper source2MatHelper [get]
 
MultiSource2MatHelperClassName requestedSource2MatHelperClassName [get, set]
 
virtual int requestedWidth [get, set]
 
virtual int requestedHeight [get, set]
 
virtual bool requestedIsFrontFacing [get, set]
 
virtual float requestedFPS [get, set]
 
virtual string requestedVideoFilePath [get, set]
 
virtual bool loop [get, set]
 
virtual string requestedImageFilePath [get, set]
 
virtual bool repeat [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.ISource2MatHelper
Source2MatHelperColorFormat outputColorFormat [get, set]
 
int timeoutFrameCount [get, set]
 
UnityEvent onInitialized [get, set]
 
UnityEvent onDisposed [get, set]
 
Source2MatHelperErrorUnityEvent onErrorOccurred [get, set]
 

Detailed Description

MultiSource 2 mat helper. v 1.0.0

Member Enumeration Documentation

◆ MultiSource2MatHelperClassCategory

Enumerator
Camera 
Video 
Image 
Custom 

◆ MultiSource2MatHelperClassName

Enumerator
WebCamTexture2MatHelper 
VideoCapture2MatHelper 
UnityVideoPlayer2MatHelper 
Image2MatHelper 
CustomSource2MatHelper 

Member Function Documentation

◆ ClassNameToClassCategory()

virtual MultiSource2MatHelperClassCategory OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.ClassNameToClassCategory ( MultiSource2MatHelperClassName  className)
protectedvirtual

◆ DidUpdateThisFrame()

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

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

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

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Dispose()

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

◆ GetBaseColorFormat()

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

Return the source base color format.

Returns
The source base color format.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetCurrentSource2MatHelperClassName()

virtual MultiSource2MatHelperClassName OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.GetCurrentSource2MatHelperClassName ( )
virtual

◆ GetDeviceName()

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

Return the source device name.

Returns
The source device name.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetHeight()

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

Return the source height.

Returns
The source height.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetMat()

virtual Mat OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.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). Please do not dispose of the returned mat as it will be reused.

Returns
The mat of the current frame.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ GetWidth()

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

Return the source width.

Returns
The source width.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Initialize()

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

Initialize this instance.

Parameters
autoPlayIf set to true play after completion of initialization.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ IsInitialized()

virtual bool OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.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.MultiSource2MatHelper.IsPaused ( )
virtual

Indicate whether the device is paused.

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

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ IsPlaying()

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

Indicate whether the source device is currently playing.

Returns
true, if the source device is playing, false otherwise.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ OnValidate()

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

◆ Pause()

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

Pause the source device.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Play()

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

Start the source device.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

◆ Stop()

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

Stop the source device.

Implements OpenCVForUnity.UnityUtils.Helper.ISource2MatHelper.

Member Data Documentation

◆ _currentSource2MatHelperClassCategory

MultiSource2MatHelperClassCategory OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._currentSource2MatHelperClassCategory = MultiSource2MatHelperClassCategory.Camera
protected

◆ _currentSource2MatHelperClassName

MultiSource2MatHelperClassName OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._currentSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatHelper
protected

◆ _customClassComponent

Component OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._customClassComponent = null
protected

Set the custom class <ISource2MatHelper> component.

◆ _loop

bool OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._loop = true
protected

Indicate whether to play this video in a loop.

◆ _onDisposed

UnityEvent OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._onDisposed
protected

UnityEvent that is triggered when this instance is disposed.

◆ _onErrorOccurred

Source2MatHelperErrorUnityEvent OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._onErrorOccurred
protected

UnityEvent that is triggered when this instance is error Occurred.

◆ _onInitialized

UnityEvent OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._onInitialized
protected

UnityEvent that is triggered when this instance is initialized.

◆ _outputColorFormat

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

Select the output color format.

◆ _repeat

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

Indicate whether to play this image in a repeat.

◆ _requestedDeviceName

string OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._requestedDeviceName = null
protected

Set the name of the camera device to use. (or device index number)

◆ _requestedFPS

float OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._requestedFPS = 30f
protected

Set the frame rate of camera.

◆ _requestedHeight

int OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._requestedHeight = 480
protected

Set the height of camera.

◆ _requestedImageFilePath

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

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

◆ _requestedIsFrontFacing

bool OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._requestedIsFrontFacing = false
protected

Set whether to use the front facing camera.

◆ _requestedSource2MatHelperClassName

MultiSource2MatHelperClassName OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._requestedSource2MatHelperClassName = MultiSource2MatHelperClassName.WebCamTexture2MatHelper
protected

Select the source to mat helper class name. If CustomSource2MatHelper is selected, only the UnityEvent inspector is overridden for the custom helper class component.

◆ _requestedVideoFilePath

string OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._requestedVideoFilePath = string.Empty
protected

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

◆ _requestedWidth

int OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._requestedWidth = 640
protected

Set the width of camera.

◆ _source2MatHelper

ISource2MatHelper OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper._source2MatHelper
protected

◆ _timeoutFrameCount

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

The number of frames before the initialization process times out.

Property Documentation

◆ loop

virtual bool OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.loop
getset

◆ onDisposed

UnityEvent OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.onDisposed
getset

◆ onErrorOccurred

Source2MatHelperErrorUnityEvent OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.onErrorOccurred
getset

◆ onInitialized

UnityEvent OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.onInitialized
getset

◆ outputColorFormat

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

◆ repeat

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

◆ requestedFPS

virtual float OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.requestedFPS
getset

◆ requestedHeight

virtual int OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.requestedHeight
getset

◆ requestedImageFilePath

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

◆ requestedIsFrontFacing

virtual bool OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.requestedIsFrontFacing
getset

◆ requestedSource2MatHelperClassName

MultiSource2MatHelperClassName OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.requestedSource2MatHelperClassName
getset

◆ requestedVideoFilePath

virtual string OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.requestedVideoFilePath
getset

◆ requestedWidth

virtual int OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.requestedWidth
getset

◆ source2MatHelper

ISource2MatHelper OpenCVForUnity.UnityUtils.Helper.MultiSource2MatHelper.source2MatHelper
get

◆ timeoutFrameCount

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

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