OpenCV for Unity 2.6.4
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.VideoCaptureCameraInputToMatHelper Class Reference

VideoCaptureCameraInput to mat helper. v 1.0.1 Depends on OpenCVForUnity version 2.4.4 (WebCamTextureToMatHelper v 1.1.3) or later. (Use the WebCamDevice.isFrontFacing and WebCamTexture.videoRotationAngle properties to flip the camera input image in VideoCaptue to the correct orientation.) More...

Public Member Functions

virtual VideoCapture GetVideoCapture ()
 Returns the VideoCapture instanse.
 
- Public Member Functions inherited from OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper
virtual bool DidUpdateThisFrame ()
 Indicates whether the video buffer of the frame has been updated.
 
virtual void Dispose ()
 Releases all resource used by the WebCamTextureToMatHelper object.
 
virtual Color32[] GetBufferColors ()
 Gets the buffer colors.
 
virtual Matrix4x4 GetCameraToWorldMatrix ()
 Returns the camera to world matrix.
 
virtual string GetDeviceName ()
 Returns the active camera device name.
 
virtual float GetFPS ()
 Returns the active camera framerate.
 
virtual int GetHeight ()
 Returns the active camera height.
 
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.
 
virtual Matrix4x4 GetProjectionMatrix ()
 Returns the projection matrix matrix.
 
virtual WebCamDevice GetWebCamDevice ()
 Returns the active WebcamDevice.
 
virtual WebCamTexture GetWebCamTexture ()
 Returns the active WebcamTexture.
 
virtual int GetWidth ()
 Returns the active camera width.
 
virtual void Initialize ()
 Initializes this instance.
 
virtual void Initialize (bool requestedIsFrontFacing, float requestedFPS=30f, bool rotate90Degree=false)
 Initializes this instance.
 
virtual void Initialize (int requestedWidth, int requestedHeight)
 Initializes this instance.
 
virtual void Initialize (string deviceName, int requestedWidth, int requestedHeight, bool requestedIsFrontFacing=false, float requestedFPS=30f, bool rotate90Degree=false)
 Initializes this instance.
 
virtual bool IsFrontFacing ()
 Indicates whether the active camera device is currently front facng.
 
virtual bool IsInitialized ()
 Indicates whether this instance has been initialized.
 
virtual bool IsPlaying ()
 Indicates whether the active camera is currently playing.
 
virtual void Pause ()
 Pauses the active camera.
 
virtual void Play ()
 Starts the camera.
 
virtual void Stop ()
 Stops the active camera.
 

Additional Inherited Members

- Public Types inherited from OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper
enum  ColorFormat : int {
  GRAY = 0 ,
  RGB ,
  BGR ,
  RGBA ,
  BGRA
}
 
enum  ErrorCode : int {
  UNKNOWN = 0 ,
  CAMERA_DEVICE_NOT_EXIST ,
  CAMERA_PERMISSION_DENIED ,
  TIMEOUT
}
 
- Public Attributes inherited from OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper
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.
 
UnityEvent onDisposed
 UnityEvent that is triggered when this instance is disposed.
 
ErrorUnityEvent onErrorOccurred
 UnityEvent that is triggered when this instance is error Occurred.
 
UnityEvent onInitialized
 UnityEvent that is triggered when this instance is initialized.
 
- Protected Member Functions inherited from OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper
virtual IEnumerator _Initialize ()
 Initializes this instance by coroutine.
 
virtual void CancelInitCoroutine ()
 Cancel Init Coroutine.
 
virtual int Channels (ColorFormat type)
 
virtual int ColorConversionCodes (ColorFormat srcType, ColorFormat dstType)
 
virtual void FlipMat (Mat mat, bool flipVertical, bool flipHorizontal)
 Flips the mat.
 
virtual IEnumerator hasUserAuthorizedCameraPermission ()
 Checks camera permission state by coroutine.
 
virtual IEnumerator OnApplicationFocus (bool hasFocus)
 
virtual void OnDestroy ()
 Raises the destroy event.
 
virtual void OnValidate ()
 
virtual void ReleaseResources ()
 To release the resources.
 
virtual void Update ()
 
- Protected Attributes inherited from OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper
bool _flipHorizontal = false
 Determines if flips horizontal.
 
bool _flipVertical = false
 Determines if flips vertically.
 
ColorFormat _outputColorFormat = ColorFormat.RGBA
 Select the output color format.
 
string _requestedDeviceName = null
 Set the name of the camera device to use. (or device index number)
 
float _requestedFPS = 30f
 Set the frame rate of camera.
 
int _requestedHeight = 480
 Set the height of camera.
 
bool _requestedIsFrontFacing = false
 Set whether to use the front facing camera.
 
int _requestedWidth = 640
 Set the width of camera.
 
bool _rotate90Degree = false
 Sets whether to rotate camera frame 90 degrees. (clockwise)
 
int _timeoutFrameCount = 1500
 The number of frames before the initialization process times out.
 
ColorFormat baseColorFormat = ColorFormat.RGBA
 The base color format.
 
Mat baseMat
 The base mat.
 
Color32[] colors
 The buffer colors.
 
Mat frameMat
 The frame mat.
 
bool hasInitDone = false
 Indicates whether this instance has been initialized.
 
IEnumerator initCoroutine
 The initialization coroutine.
 
bool isInitWaiting = false
 Indicates whether this instance is waiting for initialization to complete.
 
bool isScreenSizeChangeWaiting = false
 
Mat rotatedFrameMat
 The rotated frame mat.
 
int screenHeight
 The height of the screen.
 
ScreenOrientation screenOrientation
 The orientation of the screen.
 
int screenWidth
 The width of the screen.
 
WebCamDevice webCamDevice
 The active WebcamDevice.
 
WebCamTexture webCamTexture
 The active WebcamTexture.
 
- Properties inherited from OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper
virtual bool flipHorizontal [get, set]
 
virtual bool flipVertical [get, set]
 
virtual ColorFormat outputColorFormat [get, set]
 
virtual string requestedDeviceName [get, set]
 
virtual float requestedFPS [get, set]
 
virtual int requestedHeight [get, set]
 
virtual bool requestedIsFrontFacing [get, set]
 
virtual int requestedWidth [get, set]
 
virtual bool rotate90Degree [get, set]
 
virtual int timeoutFrameCount [get, set]
 

Detailed Description

VideoCaptureCameraInput to mat helper. v 1.0.1 Depends on OpenCVForUnity version 2.4.4 (WebCamTextureToMatHelper v 1.1.3) or later. (Use the WebCamDevice.isFrontFacing and WebCamTexture.videoRotationAngle properties to flip the camera input image in VideoCaptue to the correct orientation.)

Deprecated
Use the VideoCaptureCameraInput2MatHelper class instead.

Member Function Documentation

◆ GetVideoCapture()

virtual VideoCapture OpenCVForUnity.UnityUtils.Helper.VideoCaptureCameraInputToMatHelper.GetVideoCapture ( )
virtual

Returns the VideoCapture instanse.

Returns
The VideoCapture instanse.

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