DepthAnything / Depth-Anything-V2

Depth Anything V2. A More Capable Foundation Model for Monocular Depth Estimation
https://depth-anything-v2.github.io
Apache License 2.0
3.39k stars 277 forks source link

Question about the value in depth matrix #22

Open Liuhsinlun opened 3 months ago

Liuhsinlun commented 3 months ago

Hello, I have been researching monocular depth estimation recently. I found this place, and the documentation is very detailed, but I still have a small question that I would like the author to help me with. For each value in the depth matrix (I printed it out), do they represent the estimated real-world distance (in meters) for each pixel?

code : depth = model.infer_image(raw_img) # HxW raw depth map in numpy print("depth: \n", depth)

output : 555

osiloke commented 3 months ago

I would say this library gives you a perception of depth akin to how elevation of "cards" in UI are calculated. To get real world measurements, you still need intrinsic and extrinsic data like, camera focal length etc used to calculate a transformation matrix to map 2D pixels to real world 3D memeasurements.

An article like this one about intrinsic and extrinsic matrices may explain better

tangjunjun966 commented 4 weeks ago

@Liuhsinlun Did you solve this problem? I also want to know if the code depth = model.infer_image(raw_img) refers to the depth Wz in the camera coordinate system.

Liuhsinlun commented 3 weeks ago

666 @tangjunjun966 If u want to obtain the predicted depth values in real-world units (i.e., meters), you can use the model in this folder. Its output represents the straight-line distance from the center of the image to the object being captured.