question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to get depth image from disparity map

See original GitHub issue

When I run the submission.py on Kitti 2012, I get the disparity as output. Is it the expected output from the submission.py run?

python submission.py --maxdisp 192 --model stackhourglass --KITTI 2012 --datapath DATA/Kitti2012/testing/ --loadmodel models/pretrained/pretrained_model_KITTI2015.tar

test

I was thinking I would get a depth map of this kind (not the same image, just for example):

img

I am a bit confused.

I understand the formula depth = baseline * focal / disparity Is that what I should implement to generate the depth from the output of submission.py ?

Or is there some paramater to give to generate it directly from the run of submission?

I checked Kitti development kit and didnt find it helpful.

Any help would be welcome.

Thank you (And thank you anyway for the great implementation - great work)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

3reactions
passion3394commented, Jun 3, 2020

I have rewritten the disp_to_color.m in Python, welcome issues for somebody else, I will try to make the script running fast.

https://github.com/passion3394/PSMNet_CPU/blob/master/disp_to_color.py

2reactions
kalanityLcommented, Jun 18, 2018

Answering to myself if anyone has the same question (thanks to https://github.com/JiaRenChang/PSMNet/issues/56#issuecomment-398021563)

1/ download toolkit for sceneflow here: http://www.cvlibs.net/datasets/kitti/eval_scene_flow.php?benchmark=stereo

2/ you have ot use the disp_to_color.m file.

Assuming you have a file test.png in the same folder, this simple code is working:

disp('======= KITTI 2015 Benchmark Demo =======');

D_test = disp_read('test.png');
D_test_color=disp_to_color(D_test,192);
imwrite (D_test_color, "test_color.png")

test.png: test

test_color.png toto

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting real depth from disparity map - Stack Overflow
This will give you a disparity map for the entire image which can be transformed to 3D points using the Q matrix (cv::reprojectImageTo3D)....
Read more >
how to get depth from disparity map? - OpenCV Q&A Forum
Z = B*f / disparity is the correct formula to get the depth in mm. ( B is the baseline, the distance between...
Read more >
Disparity Map in Stereo Vision | Baeldung on Computer Science
The disparity is the apparent motion of objects between a pair of stereo images. To experience this, try closing one eye and then...
Read more >
How to get depth form disparity map · Issue #118 - GitHub
You can always convert the disparity to a depth by inverting it. If the network produces something reasonable then you can assume it...
Read more >
Depth from Stereo
Depth from Two Views: Stereo ... Figure: If I am able to find corresponding points in two images... Sanja Fidler ... We get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found