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

◆ k4a_calibration_color_2d_to_depth_2d()

k4a_result_t k4a_calibration_color_2d_to_depth_2d ( const k4a_calibration_t calibration,
const k4a_float2_t source_point2d,
const k4a_image_t  depth_image,
k4a_float2_t target_point2d,
int *  valid 
)
related

Transform a 2D pixel coordinate from color camera into a 2D pixel coordinate of the depth camera.

Parameters
calibrationLocation to read the camera calibration obtained by k4a_device_get_calibration().
source_point2dThe 2D pixel in color camera coordinates.
depth_imageHandle to input depth image.
target_point2dThe 2D pixel in depth camera coordinates.
validThe output parameter returns a value of 1 if the source_point2d is a valid coordinate in the target_camera coordinate system, and will return 0 if the coordinate is not valid in the calibration model.
Returns
K4A_RESULT_SUCCEEDED if target_point2d 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_point2d are outside of the range of valid calibration and should be ignored.
Remarks
This function represents an alternative to k4a_calibration_2d_to_2d() if the number of pixels that need to be transformed is small. This function searches along an epipolar line in the depth image to find the corresponding depth pixel. If a larger number of pixels need to be transformed, it might be computationally cheaper to call k4a_transformation_depth_image_to_color_camera() to get correspondence depth values for these color pixels, then call the function k4a_calibration_2d_to_2d().
If source_point2d does not map to a valid 2D coordinate in the target_camera coordinate system, valid is set to 0. If it is valid, valid will be set to 1. The user should not use the value of target_point2d if valid was set to 0.