Function leap_sys::LeapScaleOffsetMatrixEx
source · [−]pub unsafe extern "C" fn LeapScaleOffsetMatrixEx(
hConnection: LEAP_CONNECTION,
hDevice: LEAP_DEVICE,
camera: eLeapPerspectiveType,
dest: *mut f32
)
Expand description
\ingroup Functions
Returns the appropriate scale and offset coefficients required to project normalised Rectilinear coordinates to image-scale coordinates.
This is composed of a 4 x 4 matrix of the form:
scale_x, 0, 0, offset_x, 0, 1, 0, 0, 0, 0, scale_z, offset_z 0, 0, 0, 1
This matrix is specific to the size of the current image as contained within LEAP_IMAGE.
In practical terms, use this matrix in combination with normalised rays to project 3D points into a rectilinear image space (i.e. to visualise hands on an undistorted image).
The pipeline would be:
- Take 3D points from hand tracking.
- Apply an extrinsic transformation to a specific camera’s coordinate system (@sa LeapExtrinsicCameraMatrixEx)
- Apply a perspective division to transform 3D points to rays.
- Apply the ScaleOffset matrix to these points.
These points will now be in the correct coordinate system consistent with the undistorted rectilinear image provided by LEAP_IMAGE::distortion_matrix.
@param hConnection The connection handle created by LeapCreateConnection(). @param hDevice A device handle returned by LeapOpenDevice(). @param camera The camera to use, a member of the eLeapPerspectiveType enumeration @param[out] dest A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order @since 5.x.x