timmh/socrates

How to load precomputed depth?

Closed this issue · 2 comments

Hi Timm,

Thank you very much for your efforts to open source your dataset and codebase!

I am trying to load the precomputed depth in meters for the labelled images, but I'm not sure whether I do it correctly. The data doesn't seem do be depth directly, since the values don't fit at all (greater values for pixels closer to the camera):

data = cv2.imread("images/20220209150523_000090.exr", cv2.IMREAD_ANYCOLOR | cv2.IMREAD_ANYDEPTH)

plt.matshow(data)
plt.colorbar()

grafik

So I am assuming that the data is disparity in pixels. Converting to depth using the parameters from utils/prepare_distance_sampling.py looks more sensible, but a maximal distance of >200m seems to be quite far.

camera_baseline = 0.25  # meters
camera_horizontal_pixels = 1920  # pixels
camera_horizontal_sensor_size = 0.007564  # meters
camera_disparity_to_depth_factor = camera_focal_length * camera_baseline * camera_horizontal_pixels * camera_horizontal_sensor_size ** -1

plt.matshow(camera_disparity_to_depth_factor / data)
plt.colorbar()

grafik

It would be super helpful if you could add a code snippet showing how to correctly load the precomputed depth data.

Thank you,
Matthias

timmh commented

Hi Matthias,

you are correct, the EXR files contain disparity in pixels. I just re-checked the rectification, EXR extraction and the parameters you used, and everything seems to be correct. I also just performed ground truth measurements using a laser rangefinder, which match the distances obtained using the parameters above. Note that the baseline for this experiment was just 25cm, so measurements at large distances are expected to have huge errors. The actual largest distance, at the fence in the top left of the image, is around 140m, according to my laser rangefinder.

Please let me know if this answers your question or if I can be of help. Best,
Timm

Hi Timm,

Thank you for your reply and even doing ground truth measurements! My main concern was that I might use the data in the wrong way; this has been addressed so I'll close this issue.

Thank you,
Matthias