How to get the absolute distance from the camera to the object based on depth map?
Closed this issue · 7 comments
Hi @MRinel,
The depth output by the network, when running pred = model(input)
, is in meters.
The colored_depthmap
function simply scales the depth for visualization purposes.
Thank you for your explanation! @dwofk
There is another issue I don't quite understand. On TX2, when I use the example image, the prediction was really good [like the first image], but not so good using my own input [like the second image].I compared the input images' information, they have different depth bit, one is 32 bits, the other is 24 bits, does the last 8 bits representing transparency have any impact on prediction?
Hi @MRinel,
If there is an alpha/transparency channel present (i.e. if your current input is in RGBA color space), that channel needs to be removed first, so that the correct R, G, and B channels can then be fed into the network.
You could try converting your input from RGBA to RGB to see if this was the issue.
Hi @dwofk ,
Maybe I didn't describe it clearly.
I have transformed "deploy/data/rgb.npy,pred.npy,depth.npy" to "rgb.png,pred.png,GT-depth.png" by "data/visualize.py", they are normal like what posted on fast-depth paper. But when using my current input (without alpha channel), the outputs of visualize.py seems strange. Like next pictures.
The first image is original without alpha channel, second is "visualize.py-->rgb",third is "visualize.py-->pred", I'm confused why the RGB image cannot be restored with visualize.py .Am I getting the npy file the right way?
I get the npy file this way:
from PIL import Image
import numpy as np
im = Image.open('./data/test_0902.png')
im = im.resize((224,224),Image.ANTIALIAS)
im_array = np.array(im)
np.save('./data/test_0902.npy',im_array)
@MRinel how did u solve this issue?
@aghasaadmohammad , the strange visualization of depth image seems to be related with normalization of input image. Use matplotlib for reading input or /255. have a try :)