Azure Kinect Sensor SDK  refs/heads/master
Documentation for https://github.com/Microsoft/Azure-Kinect-Sensor-SDK

◆ k4a_calibration_2d_to_3d()

k4a_result_t k4a_calibration_2d_to_3d ( const k4a_calibration_t calibration,
const k4a_float2_t source_point2d,
const float  source_depth_mm,
const k4a_calibration_type_t  source_camera,
const k4a_calibration_type_t  target_camera,
k4a_float3_t target_point3d_mm,
int *  valid 
)
related

Transform a 2D pixel coordinate with an associated depth value of the source camera into a 3D point of the target coordinate system.

Parameters
calibrationLocation to read the camera calibration obtained by k4a_device_get_calibration().
source_point2dThe 2D pixel in source_camera coordinates.
source_depth_mmThe depth of source_point2d in millimeters. One way to derive the depth value in the color camera geometry is to use the function k4a_transformation_depth_image_to_color_camera().
source_cameraThe current camera.
target_cameraThe target camera.
target_point3d_mmPointer to the output where the 3D coordinates of the input pixel in the coordinate system of target_camera is stored in millimeters.
validThe output parameter returns a value of 1 if the source_point2d is a valid coordinate, and will return 0 if the coordinate is not valid in the calibration model.
Returns
K4A_RESULT_SUCCEEDED if target_point3d_mm was successfully written. K4A_RESULT_FAILED if calibration contained invalid transformation parameters. If the function returns K4A_RESULT_SUCCEEDED, but valid is 0, the transformation was computed, but the results in target_point3d_mm are outside of the range of valid calibration and should be ignored.
Remarks
This function applies the intrinsic calibration of source_camera to compute the 3D ray from the focal point of the camera through pixel source_point2d. The 3D point on this ray is then found using source_depth_mm. If target_camera is different from source_camera, the 3D point is transformed to target_camera using k4a_calibration_3d_to_3d(). In practice, source_camera and target_camera will often be identical. In this case, no 3D to 3D transformation is applied.
If source_point2d is not considered as valid pixel coordinate according to the intrinsic camera model, valid is set to 0. If it is valid, valid will be set to 1. The user should not use the value of target_point3d_mm if valid was set to 0.