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.
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.
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
shadows.append([int(u),int(v)])
Then, in the tracking_view.py
for shadow in shadows:
cv_kp = cvt(shadow, img_scale)
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,