[][src]Function k4a_sys::k4a_calibration_2d_to_2d

pub unsafe extern "C" fn k4a_calibration_2d_to_2d(
    calibration: *const k4a_calibration_t,
    source_point2d: *const k4a_float2_t,
    source_depth_mm: f32,
    source_camera: k4a_calibration_type_t,
    target_camera: k4a_calibration_type_t,
    target_point2d: *mut k4a_float2_t,
    valid: *mut c_int
) -> k4a_result_t

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

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

\param source_point2d The 2D pixel in \p source_camera coordinates.

\param source_depth_mm The depth of \p 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().

\param source_camera The current camera.

\param target_camera The target camera.

\param target_point2d The 2D pixel in \p target_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 maps a pixel between the coordinate systems of the depth and color cameras. It is equivalent to calling k4a_calibration_2d_to_3d() to compute the 3D point corresponding to \p source_point2d and then using k4a_calibration_3d_to_2d() to map the 3D point into the coordinate system of the \p target_camera.

\remarks If \p source_camera and \p target_camera are identical, the function immediately sets \p target_point2d to \p source_point2d and returns without computing any transformations.

\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