Distance Calculation

Hi Team,

This could sound like a noob question, but I’m new to Stereovision.

So I have a bunch of SVO files captured using the ZED2 camera. From these files, I need to calculate the distance of an object from the camera (without using the OD model that comes with ZED SDK).

I exported these SVO files to LEFT+RIGHT+DEPTH images using python export API.
Question 1: The depth map/image created through this export function is it the disparity map?

I utilised the depth calculation formula:-
depth = baseline * focal / disparity

baseline = 12 cm.
Focal = 1000 pixels ( for 1080*1920 resoultion)
disparity = values from exported depth map in pixels ranging from 0-255.

The depth calculated for the main object is beyond 60 meters which should not be the case.

I don’t have access to the ZED setup, the data is being provided to me remotely to work on.

Processing: depth000001.png…
Processing: left000001.png…

Hi @akshayklr057,

If you used this sample to export your images from the SVO file, then the depth image corresponds to depth and not disparity.

However, note that when using the sample, you have two possibilities to export your depth map : either in an 8-bit grayscale image with values between [0,255] or in a 16-bit image with values in [0,65000].
In the former case, the exported image is only used for visualisation and the values inside the image will not contain “real” depth info (you can find more about it here : Depth Sensing Overview | Stereolabs). The depth image is retrieved using the function retrieve_image
In the latter case, if you export you depth map in 16-bit encoded image, you will directly have access to depth values in millimeters at each pixel. This depth is extracted using the function retrieve_measure

Hope this helps !

1 Like

@quythao.truong Thanks for the help. I get it now, that I was using a wrong export method.