Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The way to save the disparity into image #44

Closed
keishatsai opened this issue Jan 3, 2018 · 2 comments
Closed

The way to save the disparity into image #44

keishatsai opened this issue Jan 3, 2018 · 2 comments

Comments

@keishatsai
Copy link

Hi,
I follow the demo code and try to save the depth image by using test_kitti_depth.py
Images I saved are not what I expected.......
The original input image:
0000000069
The predicted depth:
keisha_disp
The resized predicted depth:
keisha_disp_resize

those predictions I saved don't look like a proper depth map. Is there anything that I misunderstood?
Here is my code:

pred = sfm.inference(inputs, sess, mode='depth')
pred_disp = normalize_depth_for_display(pred['depth'][0,:,:,0])
cv2.imwrite('data/kitti/raw_disp.png', pred_disp)
fh_disp = open('data/kitti/raw_disp.png', 'r')
raw_disp = pil.open(fh_disp)
img_disp = raw_disp.resize((1242, 375), pil.ANTIALIAS)
img_disp.save('data/kitti/disp_resize.png')

Thanks

@keishatsai
Copy link
Author

I found that I should use matplotlib to save my instead of using opencv.
Now it is correct.

@WANGYINGYU
Copy link

@keishatsai
Hello,
I also have this problem,and I use plt.savefig() instead of using imwrite(),but I found plt.savefig() save image same as using imshow().Actually,I want get depth map and use it in other program and I want to know how to do it,can you give me some suggests?
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants