Generate metric point clouds from single images using Depth Anything V2.
git clone https://github.com/CoderSATTY/image-to-pcd.git
cd image-to-pcd
chmod +x setup.sh && ./setup.shThis downloads the model weights (~1.3GB) and sets up all dependencies.
python depth_to_pointcloud.py \
--encoder vitl \
--load-from checkpoints/depth_anything_v2_metric_hypersim_vitl.pth \
--max-depth 20 \
--img-path ./input \
--outdir ./outputArguments:
| Argument | Description | Default |
|---|---|---|
--encoder |
Model size: vits, vitb, vitl |
vitl |
--load-from |
Path to model checkpoint | Required |
--max-depth |
Max depth in meters (20=indoor, 80=outdoor) | 20 |
--img-path |
Input image(s) path | Required |
--outdir |
Output directory for .ply files | Required |
--calibration |
Camera calibration file (.npz) | Optional |
image-to-pcd/
├── setup.sh # Run this first!
├── depth_to_pointcloud.py # Main script
├── checkpoints/ # Model weights (auto-downloaded)
│ └── depth_anything_v2_metric_hypersim_vitl.pth
├── depth_anything_v2/ # Model code (auto-cloned)
├── input/ # Place your images here
└── output/ # Point clouds saved here
If you prefer manual download:
| Model | Size | Download |
|---|---|---|
| Large (recommended) | 335M | depth_anything_v2_metric_hypersim_vitl.pth |
| Base | 97.5M | depth_anything_v2_metric_hypersim_vitb.pth |
| Small | 24.8M | depth_anything_v2_metric_hypersim_vits.pth |
Place in checkpoints/ directory.
- Depth Anything V2 - NeurIPS 2024