-
Notifications
You must be signed in to change notification settings - Fork 604
Open
Description
Hello,
I am trying to estimate the true depth in cm from the relative depth and i found out i need to do some kind of calibration based on known depths.
I use the following code:
# Use depth anything model to generate depth map
depth = model.infer_image(img) # HxW raw depth map in numpy
# Relative depth normalized
depth = (depth - depth.min()) / (depth.max() - depth.min())
depth = 1 - depth
# Get relative depth
relative_depth = depth[center_y, center_x]
# Convert relative to absolute depth
rel_depths = np.array([0.04, 0.202, 0.205, 0.92])
abs_depths = np.array([85, 110, 117, 180])
# Estimate calibration function
calibration_fn = interp1d(rel_depths, abs_depths, kind='linear', fill_value="extrapolate")
# Absolute depth calculation
absolute_depth = calibration_fn(relative_depth)
I use interp1d method to find out the depth and my code works very well.
I want to ask what is the difference between the lstsq method mentioned on issue #157.
Is my approach correct??? I tried lstsq method but didn't get good results and i don't know why.
If someone can give some intuition it will be greatly appreciated!
Metadata
Metadata
Assignees
Labels
No labels