How to get GPS coordinates (WGS84) of detected object

I have bought ZED-X and ZED-BOX with ZED-F9P, how do I get the latitude and longitude of the detected object.

I think when you have the gnss working and ingest always the gps position… you could use the function Camera2Geo… where you give the POSE of the object… and you will receive the gps position…
But I didn’t use it before so you should test it.
If you use the sample program… you can easily add an pose with defined position (x,0,y0,z=10) where you should get the wgs position 10meter ahead of your current position.

Hi @WujiaPan
Welcome to the Stereolabs community.

@Martijn’s reply is correct.

You can start to work with GNSS integration by following the GitHub examples.

Hi @Myzhar @Martijn
Thank you very much for your reply.
Does your mention of add an pose with defined position (x,0,y0,z=10) refer to the 3D coordinates of the object? I refer to the example code, but I still don’t know how to add the position,Or the SDK can get the POSE of the object directly? The following code is written with reference to the geotracking example. How can I modify it.

if fusion.process() == sl.FUSION_ERROR_CODE.SUCCESS:
    fused_position = sl.Pose()
    current_state = fusion.get_position(fused_position)
    object_geopose = sl.GeoPose()
    object_3d_coordinates = np.array([0,0,10])
    if current_geopose_satus == sl.GNSS_CALIBRATION_STATE.CALIBRATED:

You simply need to call camera_to_geo on a Pose data initialized with the position of the object.

Remember to set measure3D_reference_frame to sl.REFERENCE_FRAME.WORLD to get the position of the object in the world frame and not in the camera frame.

1 Like

Hi, @Myzhar
Thank you very much for your reply.
How to get a Pose data initialized with the position of the obeject.I didn’t find any related functions in the sdk.

According to the above reply, I did not solve this problem, I don’t know how to get a Pose data initialized with the position of the obeject,has anyone implemented this feature?

Hi @WujiaPan,

Here is sample code that converts the objects’ positions into sl.Pose objects:

# Enable object detection
objects = sl.Objects()
# Inside grab() loop
for obj in objects.object_list:
    obj_translation = sl.Translation()
    obj_translation.init_vector(obj.position[0], obj.position[1], obj.position[2])

    obj_transform = sl.Transform()

    obj_pose = sl.Pose()

    # Use the camera_to_geo method here