Search code examples
matlabimage-processingstereo-3d

How to get depth of objects from Disparity Map?


I have a stereo camera setup and I am trying to generate a 3d reconstruction of the scene. I am able to obtain the disparity map from the images. After getting the disparity map, I am unable to understand how to get the scene. I am following this tutorial given by MATLAB. Can anyone please help me with it? I have uploaded all my files here.


Solution

  • Typically, the depth value is on the Z coordinate. From this disparity map, and taking in consideration the tutorial link you provided, in order to get the objects depth, you just need to know their 3D position. Once you know the actual 3D (X,Y,Z), you just need to look at the Z coordinate.

    Tutorial Section - Stitch a Sequence of Point Clouds

    hScatter.ZData = ptCloudScene.Location(:,3);