File size: 1,465 Bytes
84195c2
b7c4f7f
 
 
 
84195c2
b7c4f7f
84195c2
 
b7c4f7f
 
 
 
 
 
 
 
 
 
b3bfd8a
 
b7c4f7f
b3bfd8a
b7c4f7f
b3bfd8a
b7c4f7f
 
 
 
 
 
 
 
 
 
b3bfd8a
b7c4f7f
 
 
 
 
b3bfd8a
b7c4f7f
 
 
 
 
 
 
 
b3bfd8a
b7c4f7f
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: "2D β†’ 3D Reconstruction (GLPN + Open3D)"
emoji: 🏠
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 4.29.0
app_file: app.py
pinned: false
license: mit
tags:
  - depth-estimation
  - monocular
  - 3d-reconstruction
  - open3d
  - point-cloud
  - mesh
  - gradio
  - huggingface
---

# 2D β†’ 3D Reconstruction (GLPN + Open3D)

This Space estimates **monocular depth** from a single RGB image using **GLPN**, builds an **RGB-D point cloud**, and reconstructs a **3D mesh** with Poisson surface reconstruction via **Open3D**.

---

## πŸš€ How it works
1. Upload an image.  
2. GLPN (NYU pretrained) β†’ predict relative depth.  
3. Open3D β†’ convert RGB + depth β†’ point cloud.  
4. Poisson reconstruction β†’ mesh (downloadable `.obj` and `.ply`).  
5. Preview depth map, mesh snapshot, and explore the mesh interactively.

---

## πŸ“¦ Outputs
- **Depth map** (colorized preview)  
- **Point cloud (.ply)**  
- **Mesh (.obj)** (with Gradio 3D viewer)  
- **Mesh preview PNG** (best-effort offscreen render, if available)  

---

## ⚠️ Notes
- Monocular depth has **no absolute scale** β†’ geometry is up-to-scale only.  
- For metric accuracy, swap in stereo, multi-view SfM, or metric depth models (ZoeDepth, Depth Anything v2).  
- Works on **CPU or GPU** Spaces. GPU recommended for faster inference.  

---

## πŸ› οΈ Local Development
```bash
git clone <this-space>
cd <this-space>
pip install -r requirements.txt
python app.py