Open STRIVESS opened 1 month ago
I believe you could try the code at https://github.com/YvanYin/Metric3D/blob/main/hubconf.py#L174 .
canonical_to_real_scale = intrinsic[0] / 1000.0 # 1000.0 is the focal length of canonical camera
pred_depth = pred_depth * canonical_to_real_scale # now the depth is metric
pred_depth = torch.clamp(pred_depth, 0, 300)
I believe you could try the code at https://github.com/YvanYin/Metric3D/blob/main/hubconf.py#L174 .
canonical_to_real_scale = intrinsic[0] / 1000.0 # 1000.0 is the focal length of canonical camera pred_depth = pred_depth * canonical_to_real_scale # now the depth is metric pred_depth = torch.clamp(pred_depth, 0, 300)
Thanks for your help! I try it again.
Hello! Thank you for your excellent open-source projects. I have a project recently where I need to implement a grass-cutting robot that can recognize and avoid obstacles using vision. I'm using a monocular RGB camera and plan to perform camera calibration using OpenCV and a chessboard pattern to obtain the camera's intrinsic matrix. I have previously worked with the Depth-Anything algorithm, which allows me to obtain depth values for each pixel in the captured frames. I'm also considering trying the Metric3D algorithm. Once I obtain the intrinsic matrix, could you please guide me on how to calculate the actual distance from the camera to an object? Thanks for your help!
I want to use below codes to calculate the camera's intrinsic matrix