|
OpenCV for Unity 3.0.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.12.0/index.html ) for the details of the argument of the method.
|
OpenCV AR utilities. More...
Classes | |
| struct | PoseData |
Static Public Member Functions | |
| static float | CalculateDistance (float frustumSize, float fov) |
| Calculate distance. https://docs.unity3d.com/Manual/FrustumSizeAtDistance.html. | |
| static float | CalculateFOVAngle (float frustumSize, float distance) |
| Calculate FOV angle. https://docs.unity3d.com/Manual/FrustumSizeAtDistance.html. | |
| static float | CalculateFrustumSize (float distance, float fov) |
| Calculate frustum size. https://docs.unity3d.com/Manual/FrustumSizeAtDistance.html. | |
| static Matrix4x4 | CalculateProjectionMatrixFromCameraMatrixValues (float fx, float fy, float cx, float cy, float width, float height, float near, float far) |
| Calculate projection matrix from camera matrix values. (OpenCV coordinate system to OpenGL coordinate system) | |
| static Matrix4x4 | CameraMatrixValuesFromCalculateProjectionMatrix (Matrix4x4 projectionMatrix, float width, float height, float fovV) |
| Calculate camera matrix values from projection matrix. (OpenGL coordinate system to OpenCV coordinate system) | |
| static void | ComposeMatrix (Vector3 localPosition, Quaternion localRotation, Vector3 localScale, out Matrix4x4 matrix) |
| Compose TRS matrix from position, rotation and scale. | |
| static PoseData | ConvertMatrixToPoseData (ref Matrix4x4 matrix) |
| Convertes transform matrix to PoseData. | |
| static Matrix4x4 | ConvertPoseDataToMatrix (ref PoseData poseData, bool toLeftHandCoordinateSystem=false) |
| Convertes PoseData to transform matrix. | |
| static Quaternion | ConvertRvecToRot (double[] rvec) |
| Convertes rvec value to rotation transform. | |
| static Quaternion | ConvertRvecToRot (Mat rvec) |
| Convertes rvec value to rotation transform. | |
| static PoseData | ConvertRvecTvecToPoseData (double[] rvec, double[] tvec) |
| Convertes rvec and tvec value to PoseData. | |
| static PoseData | ConvertRvecTvecToPoseData (Mat rvec, Mat tvec) |
| Convertes rvec and tvec value to PoseData. | |
| static Vector3 | ConvertTvecToPos (double[] tvec) |
| Convertes tvec value to position transform. | |
| static Vector3 | ConvertTvecToPos (Mat tvec) |
| Convertes tvec value to position transform. | |
| static Dictionary< int, PoseData > | CreatePoseDataDict (int[] ids, double[] rvecs, double[] tvecs) |
| Creates pose data dictionary. | |
| static void | DecomposeMatrix (ref Matrix4x4 matrix, out Vector3 localPosition, out Quaternion localRotation, out Vector3 localScale) |
| Extract position, rotation and scale from TRS matrix. | |
| static Quaternion | ExtractRotationFromMatrix (ref Matrix4x4 matrix) |
| Extract rotation quaternion from transform matrix. | |
| static Vector3 | ExtractScaleFromMatrix (ref Matrix4x4 matrix) |
| Extract scale from transform matrix. | |
| static Vector3 | ExtractTranslationFromMatrix (ref Matrix4x4 matrix) |
| Extract translation from transform matrix. | |
| static void | LowpassPoseData (ref PoseData oldPose, ref PoseData newPose, float posThreshold, float rotThreshold) |
| Performs a lowpass check on the position and rotation in newPose, comparing them to oldPose. | |
| static void | LowpassPoseDataDict (Dictionary< int, PoseData > oldDict, Dictionary< int, PoseData > newDict, float posThreshold, float rotThreshold) |
| Performs a lowpass check on the position and rotation of each marker in newDict, comparing them to those in oldDict. | |
| static void | SafeDrawFrameAxes (Mat image, Mat cameraMatrix, Mat distCoeffs, Mat rvec, Mat tvec, float length, int thickness=3) |
| Safe version of drawFrameAxes that prevents hang or crashes when tvec has zero or near-zero Z component. Draw axes of the world/object coordinate system from pose estimation. | |
| static void | SetTransformFromMatrix (Transform transform, ref Matrix4x4 matrix) |
| Set transform component from TRS matrix. | |
OpenCV AR utilities.
|
static |
Calculate distance. https://docs.unity3d.com/Manual/FrustumSizeAtDistance.html.
| frustumHeight | One side size of a frustum. |
| fov | Field of view. (horizontal or vertical direction) |
|
static |
Calculate FOV angle. https://docs.unity3d.com/Manual/FrustumSizeAtDistance.html.
| frustumHeight | One side size of a frustum. |
| distance | Distance. |
|
static |
Calculate frustum size. https://docs.unity3d.com/Manual/FrustumSizeAtDistance.html.
| distance | Distance. |
| fov | Field of view. (horizontal or vertical direction) |
|
static |
Calculate projection matrix from camera matrix values. (OpenCV coordinate system to OpenGL coordinate system)
| fx | Focal length x. |
| fy | Focal length y. |
| cx | Image center point x.(principal point x) |
| cy | Image center point y.(principal point y) |
| width | Image width. |
| height | Image height. |
| near | The near clipping plane distance. |
| far | The far clipping plane distance. |
|
static |
Calculate camera matrix values from projection matrix. (OpenGL coordinate system to OpenCV coordinate system)
| projectionMatrix | Projection matrix. |
| width | Image width. |
| height | Image height. |
| fovV | Vertical field of view. |
|
static |
Compose TRS matrix from position, rotation and scale.
| localPosition | Position. |
| localRotation | Rotation. |
| localScale | Scale. |
| matrix | Transform matrix. |
|
static |
|
static |
|
static |
Convertes rvec value to rotation transform.
| tvec | Rvec. |
|
static |
Convertes rvec value to rotation transform.
| tvec | Rvec. |
|
static |
|
static |
Convertes tvec value to position transform.
| tvec | Tvec. |
|
static |
Convertes tvec value to position transform.
| tvec | Tvec. |
|
static |
Creates pose data dictionary.
| ids | ids. |
| rvecs | Rvecs. |
| tvecs | Tvecs. |
|
static |
Extract position, rotation and scale from TRS matrix.
| matrix | Transform matrix. This parameter is passed by reference to improve performance; no changes will be made to it. |
| localPosition | Position. |
| localRotation | Rotation. |
| localScale | Scale. |
|
static |
Extract rotation quaternion from transform matrix.
| matrix | Transform matrix. This parameter is passed by reference to improve performance; no changes will be made to it. |
|
static |
Extract scale from transform matrix.
| matrix | Transform matrix. This parameter is passed by reference to improve performance; no changes will be made to it. |
|
static |
Extract translation from transform matrix.
| matrix | Transform matrix. This parameter is passed by reference to improve performance; no changes will be made to it. |
|
static |
Performs a lowpass check on the position and rotation of each marker in newDict, comparing them to those in oldDict.
| oldDict | Old dictionary. |
| newDict | New dictionary. |
| posThreshold | Position threshold. |
| rotThreshold | Rotation threshold. |
|
static |
Safe version of drawFrameAxes that prevents hang or crashes when tvec has zero or near-zero Z component. Draw axes of the world/object coordinate system from pose estimation.
| image | Input/output image. It must have 1 or 3 channels. The number of channels is not altered. |
| cameraMatrix | Input 3x3 floating-point matrix of camera intrinsic parameters. \(\cameramatrix{A}\) |
| distCoeffs | Input vector of distortion coefficients \(\distcoeffs\). If the vector is empty, the zero distortion coefficients are assumed. |
| rvec | Rotation vector (see Rodrigues ) that, together with tvec, brings points from the model coordinate system to the camera coordinate system. |
| tvec | Translation vector. |
| length | Length of the painted axes in the same unit than tvec (usually in meters). |
| thickness | Line thickness of the painted axes. |
OX is drawn in red, OY in green and OZ in blue. It includes safety checks to prevent crashes when tvec has invalid Z values.
|
static |
Set transform component from TRS matrix.
| transform | Transform component. |
| matrix | Transform matrix. This parameter is passed by reference to improve performance; no changes will be made to it. |