stereolabs / zed-opencv

ZED SDK interface sample for OpenCV
https://www.stereolabs.com/docs/opencv/
MIT License
137 stars 79 forks source link

Reprojection from pixel coordinates to 3D world coordinates #86

Closed AmerSam265 closed 2 years ago

AmerSam265 commented 3 years ago

Hello, I am wondering how can I get the 3D world coordinates from pixel coordinates and ZED camera parameters, I know that we can get them directly using sl.MEASURE.XYZRGBA but I want to know how it is done mathematicaly ? Thank you in advance!

P-yver commented 3 years ago

Hi, the foruma, for a sl::CalibrationParameters::calibration_parameters cam (not sl::CalibrationParameters::calibration_parameters_raw) for a pixel p is : depth = cam.fx cam.baseline / disparity; X = (p.x - cam.cx) depth / cam.fx Y = (p.y - cam.cy) * depth / cam.fy Z = depth

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days