Skip to content

vendkura/depthanything_tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DepthAnything 3D Reconstruction Tutorial

A step-by-step pipeline that takes a single image and produces depth maps, point clouds, and 3D meshes using the DepthAnything model.

What it does

  1. Estimates depth from any RGB image using DepthAnything (Hugging Face)
  2. Generates colorized depth maps
  3. Builds point clouds via pinhole and orthographic projection
  4. Reconstructs a 3D mesh using Poisson surface reconstruction

Files

  • index.py — batch pipeline, processes multiple images from dataset/
  • index_v2.py — Streamlit web interface, upload one image and view each stage interactively

Requirements

  • Python 3.12
  • CUDA-compatible GPU (tested on RTX 3060, CUDA 13.1)

Setup

python -m venv depthanything_env
depthanything_env\Scripts\activate
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
pip install transformers open3d opencv-python matplotlib numpy streamlit plotly

Usage

Batch mode

python index.py

Randomly samples images from dataset/ and saves results to results/.

Interactive UI

streamlit run index_v2.py

Opens in browser — upload an image and walk through all 6 stages.

Output

Results are saved to results/:

  • N.png — original image
  • N_depth.png — grayscale depth map
  • N_depth_color.png — colorized depth map
  • mesh_ortho.obj — 3D mesh (compatible with Blender, Unity, Maya)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages