Calculating the x,y,z world coordinates of a pixel in the camera frame

Hi, currently I’m using the zed 2 camera and I’m running a object detection model to output the bounding box of an object in the camera frame. I’m currently trying to obtain the xyz coordinates of the centre pixel of the bounding box in world coordinates relative to the position of the camera. My setup has the camera static and I would like to get the xyz coordinates in meters relative to the camera, assuming the camera position is (0,0,0). Is this possible? Thanks!

Hello and thank you for contacting us,

It is possible. You should check out this tutorial to see how to do so :slight_smile: zed-examples/object_detection.py at master · stereolabs/zed-examples · GitHub

Antoine

Hi, I’ve seen this however the position of the object detected is grabbed through the .position attribute of the object class. However in my case I’m not using the zed object detection module and am performing my own detections through grabbing an image from the camera and then getting the bounding boxes from that. I was wondering in this case how would I get the position in meters for a pixel in the camera frame relative to the camera position? I would imagine I would need to use the positional tracking module as well but am not sure how. Thanks.