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.
|
WebCamTexture to mat helper. v 1.1.6 More...
Classes | |
class | ErrorUnityEvent |
Public Types | |
enum | ColorFormat : int { ColorFormat.GRAY = 0, ColorFormat.RGB, ColorFormat.BGR, ColorFormat.RGBA, ColorFormat.BGRA } |
enum | ErrorCode : int { ErrorCode.UNKNOWN = 0, ErrorCode.CAMERA_DEVICE_NOT_EXIST, ErrorCode.CAMERA_PERMISSION_DENIED, ErrorCode.TIMEOUT } |
Public Member Functions | |
virtual void | Initialize () |
Initializes this instance. More... | |
virtual void | Initialize (int requestedWidth, int requestedHeight) |
Initializes this instance. More... | |
virtual void | Initialize (bool requestedIsFrontFacing, float requestedFPS=30f, bool rotate90Degree=false) |
Initializes this instance. More... | |
virtual void | Initialize (string deviceName, int requestedWidth, int requestedHeight, bool requestedIsFrontFacing=false, float requestedFPS=30f, bool rotate90Degree=false) |
Initializes this instance. More... | |
virtual bool | IsInitialized () |
Indicates whether this instance has been initialized. More... | |
virtual void | Play () |
Starts the camera. More... | |
virtual void | Pause () |
Pauses the active camera. More... | |
virtual void | Stop () |
Stops the active camera. More... | |
virtual bool | IsPlaying () |
Indicates whether the active camera is currently playing. More... | |
virtual bool | IsFrontFacing () |
Indicates whether the active camera device is currently front facng. More... | |
virtual string | GetDeviceName () |
Returns the active camera device name. More... | |
virtual int | GetWidth () |
Returns the active camera width. More... | |
virtual int | GetHeight () |
Returns the active camera height. More... | |
virtual float | GetFPS () |
Returns the active camera framerate. More... | |
virtual WebCamTexture | GetWebCamTexture () |
Returns the active WebcamTexture. More... | |
virtual WebCamDevice | GetWebCamDevice () |
Returns the active WebcamDevice. More... | |
virtual Matrix4x4 | GetCameraToWorldMatrix () |
Returns the camera to world matrix. More... | |
virtual Matrix4x4 | GetProjectionMatrix () |
Returns the projection matrix matrix. More... | |
virtual bool | DidUpdateThisFrame () |
Indicates whether the video buffer of the frame has been updated. More... | |
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). Please do not dispose of the returned mat as it will be reused. More... | |
virtual Color32 [] | GetBufferColors () |
Gets the buffer colors. More... | |
virtual void | Dispose () |
Releases all resource used by the WebCamTextureToMatHelper object. More... | |
Public Attributes | |
UnityEvent | onInitialized |
UnityEvent that is triggered when this instance is initialized. More... | |
UnityEvent | onDisposed |
UnityEvent that is triggered when this instance is disposed. More... | |
ErrorUnityEvent | onErrorOccurred |
UnityEvent that is triggered when this instance is error Occurred. More... | |
bool | avoidAndroidFrontCameraLowLightIssue = false |
Indicates whether this instance avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2). Sets compulsorily the requestedFPS parameter to 15 (only when using the front camera), to avoid the problem of the WebCamTexture image becoming low light. https://forum.unity.com/threads/android-webcamtexture-in-low-light-only-some-models.520656/ https://forum.unity.com/threads/released-opencv-for-unity.277080/page-33#post-3445178 More... | |
Protected Member Functions | |
virtual void | OnValidate () |
virtual void | Update () |
virtual IEnumerator | OnApplicationFocus (bool hasFocus) |
virtual void | OnDestroy () |
Raises the destroy event. More... | |
virtual IEnumerator | _Initialize () |
Initializes this instance by coroutine. More... | |
virtual IEnumerator | hasUserAuthorizedCameraPermission () |
Checks camera permission state by coroutine. More... | |
virtual void | FlipMat (Mat mat, bool flipVertical, bool flipHorizontal) |
Flips the mat. More... | |
virtual int | Channels (ColorFormat type) |
virtual int | ColorConversionCodes (ColorFormat srcType, ColorFormat dstType) |
virtual void | CancelInitCoroutine () |
Cancel Init Coroutine. More... | |
virtual void | ReleaseResources () |
To release the resources. More... | |
Protected Attributes | |
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... | |
bool | _rotate90Degree = false |
Sets whether to rotate camera frame 90 degrees. (clockwise) More... | |
bool | _flipVertical = false |
Determines if flips vertically. More... | |
bool | _flipHorizontal = false |
Determines if flips horizontal. More... | |
ColorFormat | _outputColorFormat = ColorFormat.RGBA |
Select the output color format. More... | |
int | _timeoutFrameCount = 1500 |
The number of frames before the initialization process times out. More... | |
WebCamTexture | webCamTexture |
The active WebcamTexture. More... | |
WebCamDevice | webCamDevice |
The active WebcamDevice. More... | |
Mat | frameMat |
The frame mat. More... | |
Mat | baseMat |
The base mat. More... | |
Mat | rotatedFrameMat |
The rotated frame mat More... | |
Color32 [] | colors |
The buffer colors. More... | |
ColorFormat | baseColorFormat = ColorFormat.RGBA |
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... | |
ScreenOrientation | screenOrientation |
The orientation of the screen. More... | |
int | screenWidth |
The width of the screen. More... | |
int | screenHeight |
The height of the screen. More... | |
bool | isScreenSizeChangeWaiting = false |
Properties | |
virtual string | requestedDeviceName [get, set] |
virtual int | requestedWidth [get, set] |
virtual int | requestedHeight [get, set] |
virtual bool | requestedIsFrontFacing [get, set] |
virtual float | requestedFPS [get, set] |
virtual bool | rotate90Degree [get, set] |
virtual bool | flipVertical [get, set] |
virtual bool | flipHorizontal [get, set] |
virtual ColorFormat | outputColorFormat [get, set] |
virtual int | timeoutFrameCount [get, set] |
WebCamTexture to mat helper. v 1.1.6
By setting outputColorFormat to RGBA, processing that does not include extra color conversion is performed.
|
strong |
|
strong |
|
protectedvirtual |
Initializes this instance by coroutine.
|
protectedvirtual |
Cancel Init Coroutine.
|
protectedvirtual |
|
protectedvirtual |
|
virtual |
Indicates whether the video buffer of the frame has been updated.
true
, if the video buffer has been updated false
otherwise.
|
virtual |
Releases all resource used by the WebCamTextureToMatHelper object.
Call Dispose when you are finished using the WebCamTextureToMatHelper. The Dispose method leaves the WebCamTextureToMatHelper in an unusable state. After calling Dispose, you must release all references to the WebCamTextureToMatHelper so the garbage collector can reclaim the memory that the WebCamTextureToMatHelper was occupying.
|
protectedvirtual |
Flips the mat.
mat | Mat. |
|
virtual |
Gets the buffer colors.
|
virtual |
Returns the camera to world matrix.
|
virtual |
Returns the active camera device name.
|
virtual |
Returns the active camera framerate.
|
virtual |
Returns the active camera height.
|
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). Please do not dispose of the returned mat as it will be reused.
|
virtual |
Returns the projection matrix matrix.
|
virtual |
Returns the active WebcamDevice.
|
virtual |
Returns the active WebcamTexture.
|
virtual |
Returns the active camera width.
|
protectedvirtual |
Checks camera permission state by coroutine.
|
virtual |
Initializes this instance.
|
virtual |
Initializes this instance.
requestedWidth | Requested width. |
requestedHeight | Requested height. |
|
virtual |
Initializes this instance.
requestedIsFrontFacing | If set to true requested to using the front camera. |
requestedFPS | Requested FPS. |
rotate90Degree | If set to true requested to rotate camera frame 90 degrees. (clockwise) |
|
virtual |
Initializes this instance.
deviceName | Device name. |
requestedWidth | Requested width. |
requestedHeight | Requested height. |
requestedIsFrontFacing | If set to true requested to using the front camera. |
requestedFPS | Requested FPS. |
rotate90Degree | If set to true requested to rotate camera frame 90 degrees. (clockwise) |
|
virtual |
Indicates whether the active camera device is currently front facng.
true
, if the active camera device is front facng, false
otherwise.
|
virtual |
Indicates whether this instance has been initialized.
true
, if this instance has been initialized, false
otherwise.
|
virtual |
Indicates whether the active camera is currently playing.
true
, if the active camera is playing, false
otherwise.
|
protectedvirtual |
|
protectedvirtual |
Raises the destroy event.
|
protectedvirtual |
|
virtual |
Pauses the active camera.
|
virtual |
Starts the camera.
|
protectedvirtual |
To release the resources.
|
virtual |
Stops the active camera.
|
protectedvirtual |
|
protected |
Determines if flips horizontal.
|
protected |
Determines if flips vertically.
|
protected |
Select the output color format.
|
protected |
Set the name of the camera device to use. (or device index number)
|
protected |
Set the frame rate of camera.
|
protected |
Set the height of camera.
|
protected |
Set whether to use the front facing camera.
|
protected |
Set the width of camera.
|
protected |
Sets whether to rotate camera frame 90 degrees. (clockwise)
|
protected |
The number of frames before the initialization process times out.
bool OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = false |
Indicates whether this instance avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2). Sets compulsorily the requestedFPS parameter to 15 (only when using the front camera), to avoid the problem of the WebCamTexture image becoming low light. https://forum.unity.com/threads/android-webcamtexture-in-low-light-only-some-models.520656/ https://forum.unity.com/threads/released-opencv-for-unity.277080/page-33#post-3445178
|
protected |
The base color format.
|
protected |
The base mat.
|
protected |
The buffer colors.
|
protected |
The frame mat.
|
protected |
Indicates whether this instance has been initialized.
|
protected |
The initialization coroutine.
|
protected |
Indicates whether this instance is waiting for initialization to complete.
|
protected |
UnityEvent OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper.onDisposed |
UnityEvent that is triggered when this instance is disposed.
ErrorUnityEvent OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper.onErrorOccurred |
UnityEvent that is triggered when this instance is error Occurred.
UnityEvent OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper.onInitialized |
UnityEvent that is triggered when this instance is initialized.
|
protected |
The rotated frame mat
|
protected |
The height of the screen.
|
protected |
The orientation of the screen.
|
protected |
The width of the screen.
|
protected |
The active WebcamDevice.
|
protected |
The active WebcamTexture.
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |
|
getset |