r/computervision • u/4bjmc881 • 1d ago
Help: Theory Questions about Depth Map Generation?
Hello,
I am trying to generate a (relative) depth map from an input image. The images depict outdoor scenes, meaning: buildings, cars, roads, trees, poles, other city and landscape elements. Images are taken with a phone camera (portrait mode), and are 3072 × 4080 in size.
What models are currently the most accurate? I tested Depth Anything 3 (DA3MONO-Large) and DepthPro2 H+, but I noticed that both are quite inaccurate when it comes to scenery around 30-40+ meters away. The model fails to separate different surfaces properly, and kind of "smears" details together.
Questions:
- How can I ensure details past 30ish meters are still decently distinguished by the model instead of being smeared together?
- What inference resolution to use? I tried different ones - with DepthPro, you can essentially use everything up to the native resolution if you have enough VRAM. With DA3, you are supposed to use certain multiples of I think 14 or something. I think I tried 1008 for example.
- What is the absolute best model for my task/environment, that yields the best results? Anything that outperforms DA3 and DP2?
- My goal is to generate a dense depth map, meaning a depth value for each image pixel. My idea was to generate a relative depth map with a model, and leverage sparse but accurate depth data (e.g. handmade laser-measurements/LIDAR data) to then infer the depth for every other pixel. I think that approach should be feasible? Thoughts? I am aware there are metric variants of these models, but my results with them weren't great, that is why I want to use sparse anchors to infer the rest.
- I was wondering about 1 vs 2 images - my setup (cameras on a ring) only allow 1 image per direction, - however, the neighboring cameras have some overlap - would that help with improving accuracy? I am basically wondering what are the best options with a single image, and if known camera intrinsic and extrinsics as well as overlap of neighboring cameras allow me to refine the output?
2
u/block_intelligence 11h ago
one more angle on the smearing: those models downsample hard internally, so far objects end up covering a handful of pixels. try tiled inference. run the model on overlapping crops at near native res (say 2 to 4 tiles with decent overlap), then stitch by fitting scale and shift on the overlap region so the seams match. you get way more detail on distant stuff than one global pass at 1008.
also worth testing a global pass for layout plus tiled passes for detail, and blend with the global one as the prior. for the anchors, use robust fitting and keep a few laser points held out so you can measure the error honestly instead of eyeballing it.
if you want to compare a couple of pipelines properly, a small eval set with held-out lidar points beats picking by leaderboard. we build this kind of thing at Block Intelligence if you ever want a second pair of hands.
2
u/FirstPrinciplesRobot 21h ago
Your anchor idea is sound. Relative models give depth up to an unknown scale and shift, so fit those per image with least squares or RANSAC against your laser points. Do the fit in inverse depth (disparity) space if the model outputs affine-invariant disparity, since fitting in metric depth tends to go wrong at long range.
For the smearing at 30+ m, the main thing is that those pixels are tiny in the model's input, so feeding the whole 12MP frame downsized loses them. Running overlapping crops at higher effective resolution and aligning each crop's output to the full-frame prediction with the same scale/shift fit usually sharpens distant surfaces a lot. Then you can use a guided or edge-aware filter with the RGB image to keep depth edges on object boundaries.
The overlap between neighbouring cameras can help as a sanity check, but with a 10 to 15 cm baseline the disparity at 40 m is only a few pixels, so I wouldn't expect stereo to beat the mono model out there. It's more useful for fixing scale in the near and mid range.
1
u/blobules 1d ago
Given that you have calibrated cameras on a rigs, have you tried classical stereo? To achieve good results at long distance, you should increase the baseline (separation between two cameras) as much as possible.