[][src]Function k4a_sys::k4a_calibration_color_2d_to_depth_2d

pub unsafe extern "C" fn k4a_calibration_color_2d_to_depth_2d(
    calibration: *const k4a_calibration_t,
    source_point2d: *const k4a_float2_t,
    depth_image: k4a_image_t,
    target_point2d: *mut k4a_float2_t,
    valid: *mut c_int
) -> k4a_result_t

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

\param calibration Location to read the camera calibration obtained by k4a_device_get_calibration().

\param source_point2d The 2D pixel in \p color camera coordinates.

\param depth_image Handle to input depth image.

\param target_point2d The 2D pixel in \p depth camera coordinates.

\param valid The output parameter returns a value of 1 if the \p source_point2d is a valid coordinate in the \p target_camera coordinate system, and will return 0 if the coordinate is not valid in the calibration model.

\returns ::K4A_RESULT_SUCCEEDED if \p target_point2d was successfully written. ::K4A_RESULT_FAILED if \p calibration contained invalid transformation parameters. If the function returns ::K4A_RESULT_SUCCEEDED, but \p valid is 0, the transformation was computed, but the results in \p 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().

\remarks If \p source_point2d does not map to a valid 2D coordinate in the \p target_camera coordinate system, \p valid is set to 0. If it is valid, \p valid will be set to 1. The user should not use the value of \p target_point2d if \p valid was set to 0.

\relates k4a_calibration_t

\xmlonly k4a.h (include k4a/k4a.h) k4a.lib k4a.dll \endxmlonly