I am trying to use the StereoDepth node for getting the depth in m from the disparity map. I used the code available at Depth Preview code for getting the disparity map. And then I used the formula given on this page:

depth = focal_length_in_pixels * baseline / disparity_in_pixels

to calculate the depth in meters. I depth that I am getting is incorrect by a large extent. I have used the data available on Oak D lite official page like:

baseline: 75 mm

HFOV = 73 deg

Can someone suggest how can I get the correct depth data in m. I also tried using the prebuilt dai.node.StereoDepth.depth function which states that it outputs ImgFrame message that carries RAW16 encoded (0..65535) depth data in depth units (millimeter by default).

  • erik replied to this.

    Thanks erik for your answer.

    I was actually using the normalised disparity in the formula and that is why I was getting wrong results.

    But if I can directly get the depth values as you suggested, it is great. Thanks