How to get the floor coordinate under an object?


I am doing a person jump/climb application. I can successfully see that person coordinate based on the floor. I would like to color the floor area right under this person, how can I do that?
I can get the center point (x,y,z) of that person, just that I don’t know how to find the floor point underneath. Draw a dot or rectangle in 2D window is fine.


You have two choice:
1- you can use the parameter: PositionalTrackingParameters::set_floor_as_origin , then you can retrieve bodies data in REFERENCE_FRAME::WORLD and so simply draw something at H = 0.
2- you can call the Camera::findFloorPlane to detect the floor plane, then project the position of the body to the floor based on the detected plane equation.


I can get the 3D point of the nose

            for object in bodies.object_list:
                i = 0
                for kp_3d in object.keypoint:
                        print("nose = ", kp_3d)

nose = [ 0.22514448 1.8505745 -0.81647784]

But in the 2D view, how can I map the y of the floor right under the nose? If I set y = 0, the white dot is at the top of the window…

                for kp in obj.keypoint_2d:
                    cv_kp = cvt(kp, img_scale)
                    if(cv_kp[0] < left_display.shape[1] and cv_kp[1] < left_display.shape[0]):
              , (int(cv_kp[0]), int(cv_kp[1])), 3, color, -1)
              , (int(cv_kp[0]), **???**), 30, (255,255,255), -1)

Sorry, I’m kind of confuse with the 3D,2D coordinate based on floor and the openCV 2D window.


Once you have the 3D coordinate, you need to convert it to 2D pixel coordinates.
You can look at this documentation page that explains to you how to do it:


Stereolabs Support

Here is some of my code, I found the fx,fy,cx,cy… I wonder if they are the right ones?,be%20retrieved%20using%20getCameraInformation()%20.&text=CalibrationParameters%20calibration_params%20%3D%20zed.,-GetCalibrationParameters()%3B%20%2F%2F

    init_params.coordinate_system = sl.COORDINATE_SYSTEM.RIGHT_HANDED_Y_UP
    runtime_params.measure3D_reference_frame = sl.REFERENCE_FRAME.WORLD
    calibration_params = zed.get_camera_information().camera_configuration.calibration_parameters
# Focal length of the left eye in pixels
    fx = calibration_params.left_cam.fx
    fy = calibration_params.left_cam.fy
    cx =
    cy =
                shadows = []
                for kp_3d in object.keypoint:
                        print("nose = ", kp_3d)
                        X = kp_3d[0]
#                        Y = kp_3d[1]
                        Y = 0
                        Z = kp_3d[2]
                        X=-X #mirrored
                        u = ( X / Z ) * fx + cx 
                        v = ( Y / Z ) * fy + cy

Then, in the

    for shadow in shadows:
            cv_kp = cvt(shadow, img_scale)
  , (int(cv_kp[0]), int(cv_kp[1])), 10, (255,255,255), -1)

But the white dot stay in the middle of the screen
" Given the 3D coordinates (X,Y,Z) in the image frame (Z forward, X right, Y down)"
But even if I add Y=-Y and Z=-Z, and make the white dot as the nose,

                        Y = kp_3d[1]
#                        Y = 0

the white dot does not follow the nose…