what is the best way to visualize the depth map in MATLAB to find the depth of an object in millimeters? I am using the formula in How Field of view changes depth estimation in stereo vision? to calculate depth from disparity. now I want to measure the depth of an object in the depth map. all units are in mm. my disparity map is 786*1126 single. my depth map is the same size. I am plotting them using imagesc in MATLAB. but that does not give me any idea on the depth of an object. any help is appreciated.
Asked
Active
Viewed 3,774 times
1
-
try using surf. or you can change you image to grayscale. – user3103692 Jul 24 '14 at 21:59
-
Thank you. I have already tried that but the results were not promising. I think I need to check my disparity results again. – CV_passionate Jul 25 '14 at 13:24
1 Answers
0
You can convert the depth map into a set of 3D points, and then use plot3()
or scatter3()
to plot the points in 3D. If you want to assign the colors from the image to the points, that will take additional work. Take a look at this example.

Dima
- 38,860
- 14
- 75
- 115
-
how can I plot3() or scatter() a matrix that is not square size? my depth map is a 791*1126 single matrix in MATLAB. when I try this it does not work: X=1:size(depthMap,1); Y=1:size(depthMap,2); Z=depthMap; figure, scatter(X,Y,Z) – CV_passionate Jul 25 '14 at 17:01
-
`plot3` and `scatter3` both take x, y, and z coordinates of your points as separate vectors. – Dima Jul 25 '14 at 17:03
-
can you please clarify? if I have a matrix Z of size 791*1126, how can I plot it using scatter3? – CV_passionate Jul 25 '14 at 17:11
-
You can't. You need the corresponding matrix X and matrix Y. You would need to put together matrix Q from this question: http://stackoverflow.com/questions/11406849/using-opencv-to-generate-3d-points-assuming-frontal-parallel-configuration – Dima Jul 25 '14 at 17:41
-
Better yet, calibrate your cameras and do the reconstruction using `reconstructScene()` function as in this example: http://www.mathworks.com/help/vision/ug/stereo-vision.html – Dima Jul 25 '14 at 17:42