How to get the floor coordinate under an object?

Hi,

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.

Thx

Hi,
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.

Hi,

I can get the 3D point of the nose

``````            for object in bodies.object_list:
i = 0
for kp_3d in object.keypoint:
if(i==27):
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]):
cv2.circle(left_display, (int(cv_kp[0]), int(cv_kp[1])), 3, color, -1)
if(i==27):
cv2.circle(left_display, (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.
Thx

Hi,

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: https://support.stereolabs.com/hc/en-us/articles/4554115218711-How-can-I-convert-3D-world-coordinates-to-2D-image-coordinates-and-viceversa-.

Best,

Stereolabs Support

Hi,
Here is some of my code, I found the fx,fy,cx,cy… I wonder if they are the right ones?
https://www.stereolabs.com/docs/video/camera-calibration/#:~:text=Camera%20parameters%20are%20available%20in,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 = calibration_params.left_cam.cx
cy = calibration_params.left_cam.cy
``````
``````                shadows = []
for kp_3d in object.keypoint:
if(i==27):
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 tracking_view.py

``````    for shadow in shadows:
cv2.circle(left_display, (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…