Tohru127 commited on
Commit
6a3fc00
Β·
verified Β·
1 Parent(s): 4d61b13

area error

Browse files
Files changed (1) hide show
  1. app.py +2235 -174
app.py CHANGED
@@ -1,4 +1,1285 @@
1
- """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  Advanced 3D Reconstruction from Single Images
3
  Academic-grade pipeline with quality metrics, multiple export formats, and interactive visualization
4
  """
@@ -22,145 +1303,430 @@ import zipfile
22
  # LITERATURE REVIEW & THEORETICAL BACKGROUND
23
  # ============================================================================
24
  THEORY_TEXT = """
25
- ## Theoretical Background
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
- ### Depth Estimation Models
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  **GLPN (Global-Local Path Networks)**
30
- - Paper: "Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepth" (Kim et al., 2022)
31
- - Architecture: Hierarchical transformer with selective feature fusion
32
- - Key Innovation: Vertical CutDepth module that preserves boundary information
33
- - Training Dataset: NYU Depth V2 (indoor scenes with RGB-D pairs)
34
- - Advantages: Better boundary preservation, efficient for real-time applications
35
- - Network Depth: SegFormer-B4 backbone (~62M parameters)
36
 
37
  **DPT (Dense Prediction Transformer)**
38
- - Paper: "Vision Transformers for Dense Prediction" (Ranftl et al., 2021)
39
- - Architecture: Vision Transformer (ViT) backbone with convolutional decoder
40
- - Key Innovation: Multi-scale feature reassembly from transformer tokens
41
- - Training: Multiple datasets (NYU Depth V2, KITTI, etc.)
42
- - Advantages: Superior global context understanding, better generalization
43
- - Network Depth: ViT-Large backbone (~344M parameters)
44
-
45
- ### 3D Reconstruction Pipeline
46
-
47
- Our pipeline follows these theoretical steps:
48
-
49
- **1. Monocular Depth Estimation (Ill-posed Problem)**
50
- - Challenge: Infinite 3D scenes can project to the same 2D image
51
- - Solution: Deep learning provides probabilistic solution learned from data
52
- - Limitation: Scale ambiguity - absolute depth cannot be determined
53
- - Output: Relative depth map (closer vs farther, not actual distances)
54
-
55
- **2. Point Cloud Generation (Back-projection)**
56
- - Uses pinhole camera model: X = (u - cx) Γ— Z / fx, Y = (v - cy) Γ— Z / fy
57
- - Where: (u,v) = pixel coordinates, (cx,cy) = principal point, fx,fy = focal length, Z = depth
58
- - Assumption: Focal length = 500 pixels (reasonable for typical cameras)
59
- - Result: 3D point (X,Y,Z) for each pixel with RGB color
60
- - Coordinate system: Right-handed (X=right, Y=down, Z=forward)
61
-
62
- **3. Statistical Outlier Removal**
63
- - Method: For each point, compute distance to k nearest neighbors
64
- - Threshold: Remove points where mean distance > ΞΌ + σ×std_ratio
65
- - Parameters used: k=20 neighbors, std_ratio=2.0
66
- - Purpose: Remove depth estimation errors and noise
67
- - Typical removal: 5-15% of points
68
-
69
- **4. Normal Estimation**
70
- - Method: Principal Component Analysis (PCA) on local neighborhoods
71
- - Search: Hybrid (radius=0.1 OR max 30 neighbors)
72
- - Orientation: Align normals toward viewpoint (camera)
73
- - Purpose: Required for surface reconstruction
74
- - Result: Surface orientation vector for each point
75
-
76
- **5. Poisson Surface Reconstruction**
77
- - Paper: Kazhdan et al., "Poisson Surface Reconstruction" (2006)
78
- - Mathematical basis: Solves Poisson equation βˆ‡Β²Ο‡ = βˆ‡Β·V
79
- - V = vector field constructed from oriented normals
80
- - Ο‡ = indicator function (1 inside surface, 0 outside)
81
- - Surface = isosurface where Ο‡ = 0.5
82
- - Implementation: Octree-based (depth=10 = 1024Β³ grid resolution)
83
- - Advantages: Creates watertight (closed) meshes, smooth surfaces
84
- - Characteristics: May add extra geometry to close surface
85
- - Output: Triangulated mesh with vertices and faces
86
-
87
- **6. Mesh Post-processing**
88
- - Rotation: 180Β° around X-axis (flip upside-down to correct orientation)
89
- - Normal computation: Per-vertex normals for smooth shading
90
- - Density filtering: Remove low-density vertices (bottom 1% percentile)
91
-
92
- ### Quality Metrics Explained
93
-
94
- **Manifold Properties:**
95
- - **Edge Manifold**: Each edge shared by exactly 2 faces (no T-junctions)
96
- - **Vertex Manifold**: Neighborhood of each vertex is topologically equivalent to disk
97
- - Importance: Non-manifold geometry causes issues in 3D printing and simulation
98
-
99
- **Watertight (2-Manifold):**
100
- - Definition: Closed surface with no boundaries or holes
101
- - Topological: Can distinguish inside from outside
102
- - Practical: Required for 3D printing, volume calculations
103
-
104
- **Geometric Properties:**
105
- - **Surface Area**: Total area of all triangular faces (arbitrary units)
106
- - **Volume**: Enclosed volume, only valid if watertight (arbitrary unitsΒ³)
107
- - **Euler Characteristic**: Ο‡ = V - E + F (V=vertices, E=edges, F=faces)
108
- - For closed surface: Ο‡ = 2 - 2g (g = genus/number of holes)
109
- - Sphere: Ο‡ = 2, Torus: Ο‡ = 0
110
-
111
- ### Limitations & Theoretical Constraints
112
-
113
- **Inherent to Monocular Depth:**
114
- 1. **Scale Ambiguity**: Cannot determine absolute scale from single image
115
- 2. **Occlusions**: Hidden surfaces cannot be reconstructed (single viewpoint)
116
- 3. **Texture Dependence**: Homogeneous regions have uncertain depth
117
- 4. **Domain Gap**: Models trained on indoor data struggle with outdoor scenes
118
-
119
- **Reconstruction Artifacts:**
120
- 1. **Poisson smoothing**: May blur fine geometric details
121
- 2. **Surface completion**: Adds geometry to create closed surface
122
- 3. **Color interpolation**: Vertex colors are approximate
123
- 4. **Topology changes**: May connect separate objects
124
-
125
- **Computational Constraints:**
126
- 1. **Memory**: Large images require more RAM/VRAM
127
- 2. **Processing time**: Scales with image size and model complexity
128
- 3. **Single-threaded Poisson**: Limited parallelization in our implementation
129
-
130
- ### Comparison with Alternative Methods
131
-
132
- **Multi-view Stereo (MVS):**
133
- - Pro: More accurate, resolves scale ambiguity
134
- - Con: Requires multiple images from different viewpoints
135
- - Use case: When you can capture multiple photos
136
-
137
- **Structure from Motion (SfM):**
138
- - Pro: Recovers camera poses and 3D structure
139
- - Con: Requires video or image sequence with overlap
140
- - Use case: 3D scanning from video
141
-
142
- **LiDAR/Depth Sensors:**
143
- - Pro: Direct depth measurement, accurate scale
144
- - Con: Expensive hardware, limited to available sensors
145
- - Use case: When hardware is available (e.g., iPhone Pro)
146
-
147
- **Neural Radiance Fields (NeRF):**
148
- - Pro: Novel view synthesis, high quality
149
- - Con: Requires many images, long training time
150
- - Use case: Static scene reconstruction with many views
151
-
152
- **Gaussian Splatting:**
153
- - Pro: Real-time rendering, high quality
154
- - Con: Requires multiple views, complex pipeline
155
- - Use case: Real-time applications with capture rig
156
-
157
- ### Future Directions in Research
158
-
159
- 1. **Self-supervised Learning**: Training without ground truth depth
160
- 2. **Diffusion Models**: Probabilistic depth with uncertainty estimation
161
- 3. **Semantic Integration**: Object-aware reconstruction
162
- 4. **Multi-modal Fusion**: Combining depth, semantics, and geometry
163
- 5. **Real-time Performance**: Optimization for mobile and edge devices
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  """
165
 
166
  # ============================================================================
@@ -386,12 +1952,43 @@ def process_image(image, model_choice="GLPN (Recommended)", visualization_type="
386
  'is_watertight': mesh.is_watertight(),
387
  }
388
 
389
- # Compute surface area safely
 
390
  try:
391
  surface_area = mesh.get_surface_area()
392
- metrics['surface_area'] = float(surface_area) if surface_area > 0 else "Unable to compute"
 
 
 
 
 
393
  except Exception as e:
394
- print(f"Could not compute surface area: {e}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  metrics['surface_area'] = "Unable to compute"
396
 
397
  # Compute volume only if watertight
@@ -406,7 +2003,7 @@ def process_image(image, model_choice="GLPN (Recommended)", visualization_type="
406
  metrics['volume'] = None
407
 
408
  print("Metrics computed!")
409
- print(f"Surface area: {metrics['surface_area']}")
410
  print(f"Edge manifold: {metrics['is_edge_manifold']}")
411
  print(f"Watertight: {metrics['is_watertight']}")
412
 
@@ -514,6 +2111,8 @@ def process_image(image, model_choice="GLPN (Recommended)", visualization_type="
514
  print("Files exported!")
515
 
516
  # Create metrics report
 
 
517
  report = f"""
518
  ## Reconstruction Complete! βœ…
519
 
@@ -538,7 +2137,7 @@ def process_image(image, model_choice="GLPN (Recommended)", visualization_type="
538
  - **Volume**: {f"{metrics['volume']:.2f}" if metrics.get('volume') else 'N/A (not watertight)'}
539
 
540
  ### Quality Assessment
541
- {_generate_quality_assessment(metrics)}
542
 
543
  ### Files Exported
544
  - Point Cloud: PLY format
@@ -564,16 +2163,17 @@ def process_image(image, model_choice="GLPN (Recommended)", visualization_type="
564
  with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as demo:
565
 
566
  gr.Markdown("""
567
- # πŸ—οΈ Advanced 3D Reconstruction from Single Images
 
 
568
 
569
- **Academic-grade pipeline for monocular depth estimation and 3D surface reconstruction**
 
 
 
 
570
 
571
- Upload an image to generate:
572
- - High-quality depth maps
573
- - Colored 3D point clouds
574
- - Reconstructed mesh surfaces
575
- - Comprehensive quality metrics
576
- - Multiple export formats (PLY, OBJ, STL)
577
  """)
578
 
579
  with gr.Tabs():
@@ -680,7 +2280,381 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
680
  """)
681
 
682
  # ========== USAGE GUIDE TAB ==========
683
- with gr.Tab("πŸ“– Usage Guide"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  gr.Markdown("""
685
  ## How to Use This Application
686
 
@@ -764,12 +2738,6 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
764
  - https://www.creators3d.com/online-viewer
765
  - Just drag and drop your OBJ/PLY file
766
 
767
- ### For 3D Printing:
768
- 1. Use the `mesh.stl` file
769
- 2. Check metrics: Look for "Watertight: βœ“"
770
- 3. Import into your slicer (Cura, PrusaSlicer, etc.)
771
- 4. Scale to desired size
772
- 5. Slice and print!
773
 
774
  ## Tips for Best Results
775
 
@@ -865,11 +2833,109 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
865
  """)
866
 
867
  # ========== CITATION TAB ==========
868
- with gr.Tab("πŸ“„ Citation & Credits"):
869
  gr.Markdown("""
870
- ## How to Cite
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
871
 
872
- If you use this application in your research, please cite the relevant papers:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
873
 
874
  ### For GLPN Model:
875
  ```bibtex
@@ -900,31 +2966,26 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
900
  - **Plotly**: Interactive 3D visualization
901
  - **Gradio**: Web interface
902
 
903
- ## License & Usage
904
-
905
- - **Code**: MIT License
906
- - **Generated 3D Models**: You own the outputs
907
-
908
- ## Contact & Support
909
-
910
- For issues, questions, or suggestions, use the Community tab on Hugging Face.
911
  """)
912
 
913
  # ========== FOOTER ==========
914
  gr.Markdown("""
915
  ---
916
 
917
- ### πŸŽ“ PhD Application Demo
 
 
 
 
 
918
 
919
- This application demonstrates comprehensive understanding of:
920
- - Computer vision and deep learning
921
- - 3D geometry and reconstruction
922
- - Software engineering best practices
923
- - Research methodology and evaluation
924
 
925
- **Developed for academic research purposes**
 
 
926
 
927
- *Version 1.0*
928
  """)
929
 
930
  # ============================================================================
 
1
+ # ========== CITATION TAB ==========
2
+ with gr.Tab("πŸ“„ About & Credits"):
3
+ gr.Markdown("""
4
+ ## About This Tool
5
+
6
+ This application demonstrates how artificial intelligence can convert single 2D photographs into interactive 3D models automatically.
7
+
8
+ ### What Makes This Special
9
+
10
+ **Traditional Approach:**
11
+ - Need special equipment (3D scanner, multiple cameras)
12
+ - Requires technical expertise
13
+ - Time-consuming process
14
+ - Expensive
15
+
16
+ **This Tool:**
17
+ - βœ… Works with any photo
18
+ - βœ… No technical knowledge required
19
+ - βœ… Results in 20-30 seconds
20
+ - βœ… Completely free
21
+
22
+ ---
23
+
24
+ ## The Technology
25
+
26
+ ### AI Models Used
27
+
28
+ This tool uses state-of-the-art artificial intelligence models:
29
+
30
+ **GLPN (Global-Local Path Networks)**
31
+ - Published 2022 by researchers in South Korea
32
+ - Trained on thousands of indoor scenes
33
+ - Can estimate depth from a single image
34
+ - Fast and efficient
35
+
36
+ **DPT (Dense Prediction Transformer)**
37
+ - Published 2021 by researchers in Germany
38
+ - Uses advanced transformer architecture
39
+ - More accurate but slower
40
+ - Better for complex scenes
41
+
42
+ ### How It Works (Simple)
43
+
44
+ 1. **AI looks at photo** β†’ Recognizes objects, patterns, perspective
45
+ 2. **Estimates distance** β†’ Figures out what's close, what's far
46
+ 3. **Creates 3D points** β†’ Places colored dots in 3D space
47
+ 4. **Builds surface** β†’ Connects dots into smooth shape
48
+
49
+ ---
50
+
51
+ ## Academic References
52
+
53
+ If you use this tool for academic work, here are the papers to cite:
54
+
55
+ **For GLPN:**
56
+ ```
57
+ Kim et al. (2022). "Global-Local Path Networks for Monocular Depth
58
+ Estimation with Vertical CutDepth." IEEE Conference on Computer
59
+ Vision and Pattern Recognition (CVPR).
60
+ ```
61
+
62
+ **For DPT:**
63
+ ```
64
+ Ranftl et al. (2021). "Vision Transformers for Dense Prediction."
65
+ IEEE International Conference on Computer Vision (ICCV).
66
+ ```
67
+
68
+ **For 3D Surface Reconstruction:**
69
+ ```
70
+ Kazhdan et al. (2006). "Poisson Surface Reconstruction."
71
+ Eurographics Symposium on Geometry Processing.
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Open Source Software
77
+
78
+ This application is built using free, open-source software:
79
+
80
+ **Core Technologies:**
81
+ - **Transformers** (Hugging Face) - AI model library
82
+ - **PyTorch** - Machine learning framework
83
+ - **Open3D** - 3D data processing
84
+ - **Plotly** - Interactive visualization
85
+ - **Gradio** - Web interface
86
+
87
+ **Supporting Libraries:**
88
+ - NumPy - Mathematical computing
89
+ - SciPy - Scientific computing
90
+ - Matplotlib - Data visualization
91
+ - Pillow - Image processing
92
+
93
+ All of these are free and maintained by amazing communities!
94
+
95
+ ---
96
+
97
+ ## Free Software to Use Your Models
98
+
99
+ **Recommended for Beginners:**
100
+
101
+ **Blender** (Most Popular)
102
+ - Website: blender.org
103
+ - Free and powerful
104
+ - Huge community and tutorials
105
+ - Works on Windows, Mac, Linux
106
+
107
+ **MeshLab** (Simpler)
108
+ - Website: meshlab.net
109
+ - Easy to learn
110
+ - Good for viewing and basic editing
111
+ - Cross-platform
112
+
113
+ **Online Viewers** (No Installation)
114
+ - 3dviewer.net
115
+ - clara.io
116
+ - Just upload and view in browser
117
+
118
+ ---
119
+
120
+ ## License & Usage
121
+
122
+ **Can I Use This Freely?**
123
+ - βœ… Yes! Personal use
124
+ - βœ… Yes! Educational use
125
+ - βœ… Yes! Research use
126
+ - βœ… Yes! Commercial projects
127
+ - βœ… Yes! Share the results
128
+
129
+ **What's Included:**
130
+ - The application is free to use
131
+ - All models you create are yours
132
+ - No hidden fees or restrictions
133
+ - No registration required
134
+
135
+ **Attribution:**
136
+ - If publishing research, cite the papers above
137
+ - Mentioning this tool is appreciated but not required
138
+ - Share with others who might find it useful!
139
+
140
+ ---
141
+
142
+ ## Privacy & Your Data
143
+
144
+ **Your Photos:**
145
+ - Processed temporarily for reconstruction
146
+ - NOT stored permanently
147
+ - NOT shared with anyone
148
+ - Deleted after processing
149
+
150
+ **Your 3D Models:**
151
+ - Generated on-demand
152
+ - Downloaded to your computer
153
+ - You have complete control
154
+ - Keep them private or share them
155
+
156
+ **No Account Needed:**
157
+ - No registration required
158
+ - No personal information collected
159
+ - No tracking or analytics
160
+ - Your privacy is respected
161
+
162
+ ---
163
+
164
+ ## Acknowledgments
165
+
166
+ **Thanks To:**
167
+
168
+ - **Research Teams** who developed GLPN and DPT models
169
+ - **Hugging Face** for hosting this application
170
+ - **Open Source Community** for all the amazing tools
171
+ - **You** for using and sharing this tool!
172
+
173
+ **Special Recognition:**
174
+ - Kim et al. (GLPN research team)
175
+ - Ranftl et al. (DPT research team)
176
+ - Open3D developers
177
+ - Gradio team
178
+
179
+ ---
180
+
181
+ ## Limitations & Responsible Use
182
+
183
+ **What This Tool Cannot Do:**
184
+ - ❌ Recover hidden information (backside of objects)
185
+ - ❌ Provide precise measurements
186
+ - ❌ Work with mirrors or transparent objects
187
+ - ❌ Replace professional surveys
188
+
189
+ **Best Used For:**
190
+ - βœ… Visualization and exploration
191
+ - βœ… Learning and education
192
+ - βœ… Creative projects
193
+ - βœ… Documentation and memory preservation
194
+
195
+ **Please Use Responsibly:**
196
+ - Respect privacy when photographing spaces
197
+ - Don't photograph private property without permission
198
+ - Consider cultural sensitivities
199
+ - Use for positive purposes
200
+
201
+ ---
202
+
203
+ ## Frequently Asked Questions
204
+
205
+ **Is this really free?**
206
+ Yes! Completely free with no hidden costs.
207
+
208
+ **Do I need to create an account?**
209
+ No account needed. Just upload and use.
210
+
211
+ **Can I use it for my business?**
212
+ Yes! Commercial use is allowed.
213
+
214
+ **Who owns the 3D models I create?**
215
+ You do! They're yours to keep and use.
216
+
217
+ **Can I share this tool with others?**
218
+ Please do! Share the link freely.
219
+
220
+ **Will this always be free?**
221
+ The plan is to keep it free and accessible.
222
+
223
+ **Can I suggest improvements?**
224
+ Yes! Use the Community tab on Hugging Face.
225
+
226
+ ---
227
+
228
+ ## Contact & Support
229
+
230
+ **Having Issues?**
231
+ - Check the "Step-by-Step Guide" tab
232
+ - Review the "How It Works" tab
233
+ - Try refreshing the page
234
+ - Try a different photo
235
+
236
+ **Want to Report a Bug?**
237
+ - Use the Hugging Face Community tab
238
+ - Describe what happened
239
+ - Include what photo type you used
240
+
241
+ **Want to Learn More?**
242
+ - Explore all the tabs in this application
243
+ - Try the example projects
244
+ - Experiment with different photos
245
+ - Watch Blender tutorials online
246
+
247
+ ---
248
+
249
+ ## Future Development
250
+
251
+ **Potential Future Features:**
252
+ - Mobile app version
253
+ - Batch processing (multiple photos at once)
254
+ - Better color accuracy
255
+ - Improved mesh quality
256
+ - More export formats
257
+
258
+ **Your Feedback Matters:**
259
+ - What features would you like?
260
+ - What improvements are needed?
261
+ - What's working well?
262
+ - Share your ideas!
263
+
264
+ ---
265
+
266
+ ## Educational Resources
267
+
268
+ **Want to Learn More About 3D?**
269
+
270
+ **Blender Tutorials:**
271
+ - Blender Guru (YouTube)
272
+ - Blender official tutorials
273
+ - CG Cookie courses
274
+
275
+ **3D Concepts:**
276
+ - Khan Academy - 3D graphics basics
277
+ - Coursera - Computer Graphics courses
278
+ - YouTube - search "3D modeling basics"
279
+
280
+ **AI & Computer Vision:**
281
+ - Fast.ai courses (free)
282
+ - Google AI education
283
+ - MIT OpenCourseWare
284
+
285
+ ---
286
+
287
+ ## Version History
288
+
289
+ **Version 1.0** (Current)
290
+ - Initial release
291
+ - GLPN and DPT models
292
+ - Interactive 3D viewer
293
+ - Multiple export formats
294
+ - Quality metrics
295
+
296
+ **Planned Updates:**
297
+ - Performance improvements
298
+ - Additional models
299
+ - Enhanced visualization
300
+ - More documentation
301
+
302
+ ---
303
+
304
+ ## Thank You!
305
+
306
+ Thank you for using this tool! We hope it helps you:
307
+ - Learn about 3D technology
308
+ - Create interesting projects
309
+ - Preserve important memories
310
+ - Explore new possibilities
311
+
312
+ **Please share this tool with others who might find it useful!**
313
+
314
+ ---
315
+
316
+ *Built with ❀️ using open source technology*
317
+
318
+ *Making 3D accessible to everyone*
319
+ """)
320
+ gr.Markdown("""
321
+ ## About This Tool
322
+
323
+ This application demonstrates how artificial intelligence can convert single 2D photographs into interactive 3D models automatically.
324
+
325
+ ### What Makes This Special
326
+
327
+ **Traditional Approach:**
328
+ - Need special equipment (3D scanner, multiple cameras)
329
+ - Requires technical expertise
330
+ - Time-consuming process
331
+ - Expensive
332
+
333
+ **This Tool:**
334
+ - βœ… Works with any photo
335
+ - βœ… No technical knowledge required
336
+ - βœ… Results in 20-30 seconds
337
+ - βœ… Completely free
338
+
339
+ ---
340
+
341
+ ## The Technology
342
+
343
+ ### AI Models Used
344
+
345
+ This tool uses state-of-the-art artificial intelligence models:
346
+
347
+ **GLPN (Global-Local Path Networks)**
348
+ - Published 2022 by researchers in South Korea
349
+ - Trained on thousands of indoor scenes
350
+ - Can estimate depth from a single image
351
+ - Fast and efficient
352
+
353
+ **DPT (Dense Prediction Transformer)**
354
+ - Published 2021 by researchers in Germany
355
+ - Uses advanced transformer architecture
356
+ - More accurate but slower
357
+ - Better for complex scenes
358
+
359
+ ### How It Works (Simple)
360
+
361
+ 1. **AI looks at photo** β†’ Recognizes objects, patterns, perspective
362
+ 2. **Estimates distance** β†’ Figures out what's close, what's far
363
+ 3. **Creates 3D points** β†’ Places colored dots in 3D space
364
+ 4. **Builds surface** β†’ Connects dots into smooth shape
365
+
366
+ ---
367
+
368
+ ## Academic References
369
+
370
+ If you use this tool for academic work, here are the papers to cite:
371
+
372
+ **For GLPN:**
373
+ ```
374
+ Kim et al. (2022). "Global-Local Path Networks for Monoc with gr.Tab("πŸ’‘ Example Applications"):
375
+ gr.Markdown("""
376
+ ## What Can You Do With This Tool?
377
+
378
+ Here are some practical ways people use 3D reconstruction from photos:
379
+
380
+ ---
381
+
382
+ ###
383
+
384
+ 1. Education & Learning
385
+
386
+ **For Students:**
387
+ - Create 3D models for school projects
388
+ - Visualize concepts in 3D
389
+ - Learn about spatial relationships
390
+ - Make presentations more engaging
391
+
392
+ **For Teachers:**
393
+ - Demonstrate 3D concepts
394
+ - Create teaching materials
395
+ - Show real-world examples
396
+ - Make lessons interactive
397
+
398
+ **Example Project:**
399
+ *"Historical Site Documentation"*
400
+ - Photograph local historical building
401
+ - Create 3D model
402
+ - Present to class
403
+ - Discuss architecture and history
404
+
405
+ ---
406
+
407
+ ### 2. Documentation & Preservation
408
+
409
+ **Personal Use:**
410
+ - Document your home or apartment
411
+ - Keep memories of places
412
+ - Record spaces before moving
413
+ - Create virtual tours
414
+
415
+ **Professional Use:**
416
+ - Document buildings or sites
417
+ - Record current conditions
418
+ - Create visual archives
419
+ - Support reports with 3D visuals
420
+
421
+ **Example Project:**
422
+ *"Before Renovation Record"*
423
+ - Photograph rooms before remodeling
424
+ - Create 3D documentation
425
+ - Compare before and after
426
+ - Remember original layout
427
+
428
+ ---
429
+
430
+ ### 3. Creative Projects & Art
431
+
432
+ **Digital Art:**
433
+ - Create 3D art from photos
434
+ - Generate unique perspectives
435
+ - Combine multiple models
436
+ - Use in digital compositions
437
+
438
+ **3D Printing:**
439
+ - Print real-world objects
440
+ - Create physical models
441
+ - Make miniatures
442
+ - Prototype designs
443
+
444
+ **Example Project:**
445
+ *"Memory Object"*
446
+ - Photograph meaningful object
447
+ - Create 3D model
448
+ - 3D print a copy
449
+ - Gift to someone special
450
+
451
+ ---
452
+
453
+ ### 4. Research & Analysis
454
+
455
+ **Academic Research:**
456
+ - Document field sites
457
+ - Create visual data
458
+ - Support observations
459
+ - Share findings visually
460
+
461
+ **Spatial Analysis:**
462
+ - Understand space relationships
463
+ - Measure rough proportions
464
+ - Visualize environments
465
+ - Present findings
466
+
467
+ **Example Project:**
468
+ *"Room Layout Study"*
469
+ - Photograph different room types
470
+ - Generate 3D models
471
+ - Compare spatial arrangements
472
+ - Analyze patterns
473
+
474
+ ---
475
+
476
+ ### 5. Presentations & Communication
477
+
478
+ **Business:**
479
+ - Visualize spaces for clients
480
+ - Create facility documentation
481
+ - Support proposals with 3D views
482
+ - Make meetings more engaging
483
+
484
+ **Meetings:**
485
+ - Show locations remotely
486
+ - Discuss spaces collaboratively
487
+ - Share 3D perspectives
488
+ - Improve understanding
489
+
490
+ **Example Project:**
491
+ *"Office Space Presentation"*
492
+ - Photograph current office
493
+ - Show layout in 3D
494
+ - Discuss rearrangement ideas
495
+ - Visualize proposals
496
+
497
+ ---
498
+
499
+ ### 6. Personal Projects
500
+
501
+ **Home Projects:**
502
+ - Plan furniture arrangements
503
+ - Visualize renovations
504
+ - Document DIY progress
505
+ - Share with contractors
506
+
507
+ **Hobbies:**
508
+ - Model making reference
509
+ - Gaming environments
510
+ - Virtual reality content
511
+ - Photo experiments
512
+
513
+ **Example Project:**
514
+ *"Furniture Planning"*
515
+ - Photograph empty room
516
+ - Create 3D model
517
+ - Visualize furniture placement
518
+ - Plan shopping list
519
+
520
+ ---
521
+
522
+ ## Step-by-Step Example Projects
523
+
524
+ ### Project 1: Document Your Living Space (Easy)
525
+
526
+ **Time Required:** 30 minutes
527
+
528
+ **Steps:**
529
+ 1. Clean and organize your room (5 min)
530
+ 2. Take 4 photos from each corner (5 min)
531
+ 3. Upload each photo to this tool (5 min)
532
+ 4. Download all 3D models (2 min)
533
+ 5. View in 3D viewer or Blender (13 min)
534
+
535
+ **What You Learn:**
536
+ - How to take good 3D photos
537
+ - Understanding depth maps
538
+ - Basic 3D file handling
539
+
540
+ **What You Get:**
541
+ - 3D record of your space
542
+ - Practice with the tool
543
+ - Files you can keep forever
544
+
545
+ ---
546
+
547
+ ### Project 2: Create a 3D Memory (Intermediate)
548
+
549
+ **Time Required:** 1-2 hours
550
+
551
+ **Steps:**
552
+ 1. Choose a meaningful object or place
553
+ 2. Photograph from best angle
554
+ 3. Generate 3D model
555
+ 4. Download and open in Blender
556
+ 5. Clean up and refine the model
557
+ 6. Export and share or 3D print
558
+
559
+ **What You Learn:**
560
+ - Photo composition for 3D
561
+ - Basic Blender navigation
562
+ - 3D file editing
563
+
564
+ **What You Get:**
565
+ - Preserved memory in 3D
566
+ - New 3D skills
567
+ - Shareable or printable model
568
+
569
+ ---
570
+
571
+ ### Project 3: Before/After Comparison (Advanced)
572
+
573
+ **Time Required:** Multiple sessions
574
+
575
+ **Steps:**
576
+ 1. Photograph space "before" changes
577
+ 2. Create and save 3D model
578
+ 3. Make changes (rearrange, renovate, etc.)
579
+ 4. Photograph "after"
580
+ 5. Create new 3D model
581
+ 6. Compare side-by-side
582
+
583
+ **What You Learn:**
584
+ - Temporal documentation
585
+ - Consistent photography
586
+ - Comparative analysis
587
+
588
+ **What You Get:**
589
+ - Visual record of changes
590
+ - Story to tell
591
+ - Evidence of transformation
592
+
593
+ ---
594
+
595
+ ## Success Stories & Use Cases
596
+
597
+ ### Education Sector
598
+
599
+ **High School Science Class:**
600
+ - Students photograph local landmarks
601
+ - Create 3D models for geology project
602
+ - Present findings with 3D visualizations
603
+ - Learn about spatial concepts
604
+
605
+ **University Architecture Course:**
606
+ - Document existing buildings
607
+ - Analyze spatial design
608
+ - Create reference models
609
+ - Support design proposals
610
+
611
+ ---
612
+
613
+ ### Personal Use
614
+
615
+ **Moving Day Documentation:**
616
+ - Photograph apartment before leaving
617
+ - Create 3D memory of first home
618
+ - Share with family
619
+ - Return virtually anytime
620
+
621
+ **Home Improvement:**
622
+ - Document kitchen before renovation
623
+ - Plan new layout
624
+ - Show contractors the space
625
+ - Track progress over time
626
+
627
+ ---
628
+
629
+ ### Professional Use
630
+
631
+ **Real Estate:**
632
+ - Create 3D views of properties
633
+ - Send to remote clients
634
+ - Show spatial relationships
635
+ - Enhance listings
636
+
637
+ **Interior Design:**
638
+ - Document client spaces
639
+ - Visualize existing conditions
640
+ - Plan interventions
641
+ - Communicate ideas
642
+
643
+ ---
644
+
645
+ ## Tips from Experienced Users
646
+
647
+ ### Photography Tips:
648
+
649
+ "Take photos during the day with natural light - the results are much better!"
650
+
651
+ "I always include something with known size (like a door) for reference."
652
+
653
+ "Multiple photos from different angles give you more options."
654
+
655
+ ### Processing Tips:
656
+
657
+ "GLPN is usually good enough - save the DPT for special projects."
658
+
659
+ "Download everything right away - don't rely on the browser to keep it."
660
+
661
+ "The point cloud view is great for checking quality before downloading."
662
+
663
+ ### Usage Tips:
664
+
665
+ "Blender has a learning curve but YouTube tutorials help a lot."
666
+
667
+ "For 3D printing, check if it says 'Watertight' before printing."
668
+
669
+ "Keep your original photos - you can always regenerate if needed."
670
+
671
+ ---
672
+
673
+ ## Getting Started Checklist
674
+
675
+ **Before You Begin:**
676
+ - [ ] Have photos ready (or know what to photograph)
677
+ - [ ] Check photos are clear and well-lit
678
+ - [ ] Read the Step-by-Step Guide
679
+ - [ ] Decide what you want to do with the model
680
+
681
+ **During Processing:**
682
+ - [ ] Upload photo
683
+ - [ ] Choose model (GLPN for speed)
684
+ - [ ] Click Start Reconstruction
685
+ - [ ] Wait patiently (10-30 seconds)
686
+
687
+ **After Processing:**
688
+ - [ ] Explore in 3D viewer
689
+ - [ ] Check quality metrics
690
+ - [ ] Download ZIP file
691
+ - [ ] Save to organized folder
692
+
693
+ **Next Steps:**
694
+ - [ ] Install Blender or MeshLab (optional)
695
+ - [ ] Open and view your models
696
+ - [ ] Experiment and have fun!
697
+ - [ ] Try more photos
698
+
699
+ ---
700
+
701
+ ## Inspiration Gallery
702
+
703
+ **What Others Have Created:**
704
+
705
+ - Childhood bedroom preserved in 3D
706
+ - Local coffee shop virtual tour
707
+ - Grandmother's garden memorial
708
+ - Student archaeology site documentation
709
+ - Home office layout planning
710
+ - Miniature 3D printed childhood home
711
+ - Historical building digital archive
712
+ - Room escape game environments
713
+
714
+ **Your Turn!**
715
+
716
+ What will you create? The possibilities are endless!
717
+ """)
718
+ gr.Markdown("""
719
+ ## Real-World Applications in Geography & Urban Planning
720
+
721
+ ### 1. Heritage Documentation
722
+
723
+ **Use Case**: Document historic buildings in rapidly changing neighborhoods
724
+
725
+ **Process:**
726
+ - Photograph building facades at street level
727
+ - Generate 3D models for digital archive
728
+ - Monitor condition over time
729
+ - Support preservation applications
730
+
731
+ **Geographic Value:**
732
+ - Creates permanent spatial record
733
+ - Supports heritage impact assessments
734
+ - Enables virtual access for research
735
+ - Documents threatened architecture
736
+
737
+ **Best For:**
738
+ - Historic districts
739
+ - Vernacular architecture
740
+ - Cultural landscapes
741
+ - Disappearing urban forms
742
+
743
+ ---
744
+
745
+ ### 2. Informal Settlement Mapping
746
+
747
+ **Use Case**: Participatory documentation of underserved neighborhoods
748
+
749
+ **Process:**
750
+ - Community members photograph homes
751
+ - Generate spatial database
752
+ - Identify infrastructure needs
753
+ - Plan upgrading strategies
754
+
755
+ **Geographic Value:**
756
+ - Bottom-up data collection
757
+ - Empowers marginalized communities
758
+ - Reveals spatial patterns
759
+ - Supports equitable planning
760
+
761
+ **Best For:**
762
+ - Slum upgrading projects
763
+ - Land tenure documentation
764
+ - Infrastructure planning
765
+ - Social housing programs
766
+
767
+ ---
768
+
769
+ ### 3. Public Space Analysis
770
+
771
+ **Use Case**: Assess quality and design of plazas, parks, streets
772
+
773
+ **Process:**
774
+ - Document existing conditions
775
+ - Analyze spatial proportions
776
+ - Measure enclosure ratios
777
+ - Evaluate accessibility
778
+
779
+ **Geographic Value:**
780
+ - Quantifies urban design qualities
781
+ - Supports design guidelines
782
+ - Enables comparative analysis
783
+ - Informs placemaking
784
+
785
+ **Best For:**
786
+ - Plaza redesign projects
787
+ - Street improvement plans
788
+ - Pedestrian zone studies
789
+ - Active transportation planning
790
+
791
+ ---
792
+
793
+ ### 4. Climate Adaptation Assessment
794
+
795
+ **Use Case**: Analyze built environment for heat mitigation strategies
796
+
797
+ **Process:**
798
+ - Document building orientations
799
+ - Map shade patterns
800
+ - Identify green infrastructure
801
+ - Assess ventilation corridors
802
+
803
+ **Geographic Value:**
804
+ - Supports urban heat island analysis
805
+ - Identifies vulnerable areas
806
+ - Plans cooling strategies
807
+ - Integrates with climate models
808
+
809
+ **Best For:**
810
+ - Heat action plans
811
+ - Green infrastructure siting
812
+ - Ventilation studies
813
+ - Solar access analysis
814
+
815
+ ---
816
+
817
+ ### 5. Neighborhood Change Documentation
818
+
819
+ **Use Case**: Track gentrification and urban transformation
820
+
821
+ **Process:**
822
+ - Photograph neighborhoods over time
823
+ - Document building changes
824
+ - Map new construction
825
+ - Analyze displacement patterns
826
+
827
+ **Geographic Value:**
828
+ - Longitudinal spatial data
829
+ - Supports equity research
830
+ - Documents displacement
831
+ - Informs anti-displacement policies
832
+
833
+ **Best For:**
834
+ - Gentrification studies
835
+ - Displacement research
836
+ - Community advocacy
837
+ - Policy evaluation
838
+
839
+ ---
840
+
841
+ ### 6. Economic Geography Analysis
842
+
843
+ **Use Case**: Study retail corridors and commercial districts
844
+
845
+ **Process:**
846
+ - Document storefronts
847
+ - Map business types
848
+ - Analyze spatial patterns
849
+ - Track vacancies
850
+
851
+ **Geographic Value:**
852
+ - Reveals economic vitality
853
+ - Identifies spatial clusters
854
+ - Supports business districts
855
+ - Informs economic development
856
+
857
+ **Best For:**
858
+ - Main street revitalization
859
+ - Business improvement districts
860
+ - Commercial corridor studies
861
+ - Retail market analysis
862
+
863
+ ---
864
+
865
+ ### 7. Disaster Response & Recovery
866
+
867
+ **Use Case**: Rapid assessment after natural disasters
868
+
869
+ **Process:**
870
+ - Pre-disaster documentation
871
+ - Post-event damage assessment
872
+ - Track reconstruction progress
873
+ - Support recovery planning
874
+
875
+ **Geographic Value:**
876
+ - Before/after comparisons
877
+ - Rapid field assessment
878
+ - Low-cost documentation
879
+ - Supports resilience planning
880
+
881
+ **Best For:**
882
+ - Hurricane damage assessment
883
+ - Earthquake recovery
884
+ - Flood impact studies
885
+ - Emergency planning
886
+
887
+ ---
888
+
889
+ ### 8. Participatory Urban Design
890
+
891
+ **Use Case**: Community-led design processes
892
+
893
+ **Process:**
894
+ - Residents document favorite places
895
+ - Identify problem areas
896
+ - Visualize existing conditions
897
+ - Co-create design solutions
898
+
899
+ **Geographic Value:**
900
+ - Inclusive decision-making
901
+ - Local knowledge capture
902
+ - Empowers communities
903
+ - Builds social capital
904
+
905
+ **Best For:**
906
+ - Community design charrettes
907
+ - Participatory budgeting
908
+ - Neighborhood planning
909
+ - Public engagement
910
+
911
+ ---
912
+
913
+ ## Sample Projects
914
+
915
+ ### Project 1: Historic Downtown Survey
916
+
917
+ **Objective**: Document all buildings in historic district
918
+
919
+ **Methodology:**
920
+ 1. Grid-based photo survey (both sides of street)
921
+ 2. Process 50-100 images
922
+ 3. Generate 3D archive
923
+ 4. Import to GIS with attributes
924
+ 5. Create online map for community
925
+
926
+ **Deliverables:**
927
+ - 3D model library
928
+ - Condition assessment database
929
+ - Interactive web map
930
+ - Preservation recommendations
931
+
932
+ **Timeline**: 1 week field work, 1 week processing
933
+
934
+ ---
935
+
936
+ ### Project 2: Walkability Assessment
937
+
938
+ **Objective**: Evaluate pedestrian environment quality
939
+
940
+ **Methodology:**
941
+ 1. Photograph street sections every 50m
942
+ 2. Generate 3D models of streetscape
943
+ 3. Measure enclosure ratios
944
+ 4. Assess visual complexity
945
+ 5. Calculate walkability scores
946
+
947
+ **Deliverables:**
948
+ - Walkability heat maps
949
+ - Design recommendations
950
+ - Before/after visualizations
951
+ - Implementation priorities
952
+
953
+ **Timeline**: 3 days field work, 2 days analysis
954
+
955
+ ---
956
+
957
+ ### Project 3: Affordable Housing Study
958
+
959
+ **Objective**: Document threatened affordable housing
960
+
961
+ **Methodology:**
962
+ 1. Community members photograph buildings
963
+ 2. Train residents in photo techniques
964
+ 3. Generate spatial inventory
965
+ 4. Map displacement risk
966
+ 5. Advocate for protections
967
+
968
+ **Deliverables:**
969
+ - Community-generated database
970
+ - Risk assessment maps
971
+ - Policy recommendations
972
+ - Advocacy toolkit
973
+
974
+ **Timeline**: 2 weeks participatory mapping
975
+
976
+ ---
977
+
978
+ ## Integration Examples
979
+
980
+ ### Example 1: QGIS Urban Analysis
981
+
982
+ **Workflow:**
983
+ ```
984
+ 1. Capture: Street-level photos of commercial corridor
985
+ 2. Process: Generate point clouds for each block
986
+ 3. Import: Load into QGIS as point cloud layers
987
+ 4. Georeference: Add GPS coordinates from field notes
988
+ 5. Analyze: Calculate building heights, facade areas
989
+ 6. Visualize: Create 3D scene with basemap
990
+ 7. Export: Web scene for public viewing
991
+ ```
992
+
993
+ **Result**: Interactive 3D corridor analysis
994
+
995
+ ---
996
+
997
+ ### Example 2: SketchUp Context Model
998
+
999
+ **Workflow:**
1000
+ ```
1001
+ 1. Capture: Photos of project site and surroundings
1002
+ 2. Process: Generate mesh models
1003
+ 3. Import: Load OBJ files into SketchUp
1004
+ 4. Arrange: Position in site context
1005
+ 5. Design: Add proposed building massing
1006
+ 6. Test: Shadow studies, view corridors
1007
+ 7. Present: Renderings for community meeting
1008
+ ```
1009
+
1010
+ **Result**: Context-sensitive design proposals
1011
+
1012
+ ---
1013
+
1014
+ ### Example 3: Multi-temporal Change Analysis
1015
+
1016
+ **Workflow:**
1017
+ ```
1018
+ 1. Baseline: Document neighborhood (Year 0)
1019
+ 2. Monitor: Re-photograph annually (Years 1-5)
1020
+ 3. Process: Generate comparable 3D models
1021
+ 4. Compare: Identify changes in built form
1022
+ 5. Quantify: Measure new construction, demolitions
1023
+ 6. Analyze: Correlate with demographic changes
1024
+ 7. Report: Visualize gentrification patterns
1025
+ ```
1026
+
1027
+ **Result**: Longitudinal urban change study
1028
+
1029
+ ---
1030
+
1031
+ ## Research Applications
1032
+
1033
+ ### Urban Morphology
1034
+ - Building type classification
1035
+ - Form-based analysis
1036
+ - Density calculations
1037
+ - Spatial pattern recognition
1038
+
1039
+ ### Social Geography
1040
+ - Neighborhood character assessment
1041
+ - Place identity studies
1042
+ - Community asset mapping
1043
+ - Vernacular architecture documentation
1044
+
1045
+ ### Environmental Geography
1046
+ - Urban heat island analysis
1047
+ - Green infrastructure mapping
1048
+ - Microclimate studies
1049
+ - Sustainable urbanism metrics
1050
+
1051
+ ### Historical Geography
1052
+ - Temporal change analysis
1053
+ - Heritage landscape documentation
1054
+ - Urban evolution studies
1055
+ - Preservation planning
1056
+
1057
+ ---
1058
+
1059
+ ## Cost-Benefit Analysis
1060
+
1061
+ ### Traditional Methods vs. This Tool
1062
+
1063
+ **Terrestrial Laser Scanning (TLS):**
1064
+ - Equipment: $30,000 - $100,000
1065
+ - Training: Weeks to months
1066
+ - Processing: Specialized software
1067
+ - **This tool**: Free, smartphone camera, instant results
1068
+
1069
+ **Professional Photogrammetry:**
1070
+ - Software: $2,000 - $10,000/year
1071
+ - Processing: Hours per model
1072
+ - Expertise: Technical specialist needed
1073
+ - **This tool**: Free, 20 seconds, user-friendly
1074
+
1075
+ **Drone Survey:**
1076
+ - Equipment: $1,000 - $15,000
1077
+ - License: FAA Part 107 required (USA)
1078
+ - Weather: Limited by conditions
1079
+ - **This tool**: No permits, works at street level
1080
+
1081
+ ### Return on Investment
1082
+
1083
+ **For Research:**
1084
+ - Rapid data collection
1085
+ - Low barrier to entry
1086
+ - Enables exploratory studies
1087
+ - Supports grant applications
1088
+
1089
+ **For Practice:**
1090
+ - Quick site assessments
1091
+ - Client presentations
1092
+ - Community engagement
1093
+ - Design iteration
1094
+
1095
+ **For Education:**
1096
+ - Hands-on learning
1097
+ - Real-world projects
1098
+ - Accessible technology
1099
+ - Portfolio development
1100
+
1101
+ ---
1102
+
1103
+ ## Limitations & When to Use Alternatives
1104
+
1105
+ ### Use This Tool When:
1106
+ - βœ… Preliminary assessment needed
1107
+ - βœ… Budget is limited
1108
+ - βœ… Rapid documentation required
1109
+ - βœ… Community participation desired
1110
+ - βœ… Teaching/learning application
1111
+ - βœ… Concept visualization needed
1112
+
1113
+ ### Use Professional Methods When:
1114
+ - ❌ Legal/engineering requirements
1115
+ - ❌ Precise measurements needed
1116
+ - ❌ Large area coverage required
1117
+ - ❌ Absolute accuracy critical
1118
+ - ❌ Official documentation needed
1119
+ - ❌ Structural analysis required
1120
+
1121
+ ### Complementary Approaches:
1122
+ - Combine with GPS for georeferencing
1123
+ - Use with traditional surveys for scale
1124
+ - Integrate with census data for demographics
1125
+ - Link with property records for attributes
1126
+ - Connect with climate data for analysis
1127
+ """)
1128
+ gr.Markdown("""
1129
+ ## Real-World Applications in Geography & Urban Planning
1130
+
1131
+ ### 1. Heritage Documentation
1132
+
1133
+ **Use Case**: Document historic buildings in rapidly changing neighborhoods
1134
+
1135
+ **Process:**
1136
+ - Photograph building facades at street level
1137
+ - Generate 3D models for digital archive
1138
+ - Monitor condition over time
1139
+ - Support preservation applications
1140
+
1141
+ **Geographic Value:**
1142
+ - Creates permanent spatial record
1143
+ - Supports heritage impact assessments
1144
+ - Enables virtual access for research
1145
+ - Documents threatened architecture
1146
+
1147
+ **Best For:**
1148
+ - Historic districts
1149
+ - Vernacular architecture
1150
+ - Cultural landscapes
1151
+ - Disappearing urban forms
1152
+
1153
+ ---
1154
+
1155
+ ### 2. Informal Settlement Mapping
1156
+
1157
+ **Use Case**: Participatory documentation of underserved neighborhoods
1158
+
1159
+ **Process:**
1160
+ - Community members photograph homes
1161
+ - Generate spatial database
1162
+ - Identify infrastructure needs
1163
+ - Plan upgrading strategies
1164
+
1165
+ **Geographic Value:**
1166
+ - Bottom-up data collection
1167
+ - Empowers marginalized communities
1168
+ - Reveals spatial patterns
1169
+ - Supports equitable planning
1170
+
1171
+ **Best For:**
1172
+ - Slum upgrading projects
1173
+ - Land tenure documentation
1174
+ - Infrastructure planning
1175
+ - Social housing programs
1176
+
1177
+ ---
1178
+
1179
+ ### 3. Public Space Analysis
1180
+
1181
+ **Use Case**: Assess quality and design of plazas, parks, streets
1182
+
1183
+ **Process:**
1184
+ - Document existing conditions
1185
+ - Analyze spatial proportions
1186
+ - Measure enclosure ratios
1187
+ - Evaluate accessibility
1188
+
1189
+ **Geographic Value:**
1190
+ - Quantifies urban design qualities
1191
+ - Supports design guidelines
1192
+ - Enables comparative analysis
1193
+ - Informs placemaking
1194
+
1195
+ **Best For:**
1196
+ - Plaza redesign projects
1197
+ - Street improvement plans
1198
+ - Pedestrian zone studies
1199
+ - Active transportation planning
1200
+
1201
+ ---
1202
+
1203
+ ### 4. Climate Adaptation Assessment
1204
+
1205
+ **Use Case**: Analyze built environment for heat mitigation strategies
1206
+
1207
+ **Process:**
1208
+ - Document building orientations
1209
+ - Map shade patterns
1210
+ - Identify green infrastructure
1211
+ - Assess ventilation corridors
1212
+
1213
+ **Geographic Value:**
1214
+ - Supports urban heat island analysis
1215
+ - Identifies vulnerable areas
1216
+ - Plans cooling strategies
1217
+ - Integrates with climate models
1218
+
1219
+ **Best For:**
1220
+ - Heat action plans
1221
+ - Green infrastructure siting
1222
+ - Ventilation studies
1223
+ - Solar access analysis
1224
+
1225
+ ---
1226
+
1227
+ ### 5. Neighborhood Change Documentation
1228
+
1229
+ **Use Case**: Track gentrification and urban transformation
1230
+
1231
+ **Process:**
1232
+ - Photograph neighborhoods over time
1233
+ - Document building changes
1234
+ - Map new construction
1235
+ - Analyze displacement patterns
1236
+
1237
+ **Geographic Value:**
1238
+ - Longitudinal spatial data
1239
+ - Supports equity research
1240
+ - Documents displacement
1241
+ - Informs anti-displacement policies
1242
+
1243
+ **Best For:**
1244
+ - Gentrification studies
1245
+ - Displacement research
1246
+ - Community advocacy
1247
+ - Policy evaluation
1248
+
1249
+ ---
1250
+
1251
+ ### 6. Economic Geography Analysis
1252
+
1253
+ **Use Case**: Study retail corridors and commercial districts
1254
+
1255
+ **Process:**
1256
+ - Document storefronts
1257
+ - Map business types
1258
+ - Analyze spatial patterns
1259
+ - Track vacancies
1260
+
1261
+ **Geographic Value:**
1262
+ - Reveals economic vitality
1263
+ - Identifies spatial clusters
1264
+ - Supports business districts
1265
+ - Informs economic development
1266
+
1267
+ **Best For:**
1268
+ - Main street revitalization
1269
+ - Business improvement districts
1270
+ - Commercial corridor studies
1271
+ - Retail market analysis
1272
+
1273
+ ---
1274
+
1275
+ ### 7. Disaster Response & Recovery
1276
+
1277
+ **Use Case**: Rapid assessment after natural disasters
1278
+
1279
+ **Process:**
1280
+ - Pre-disaster documentation
1281
+ - Post-event damage assessment
1282
+ - Track reconstruction"""
1283
  Advanced 3D Reconstruction from Single Images
1284
  Academic-grade pipeline with quality metrics, multiple export formats, and interactive visualization
1285
  """
 
1303
  # LITERATURE REVIEW & THEORETICAL BACKGROUND
1304
  # ============================================================================
1305
  THEORY_TEXT = """
1306
+ ## How It Works (Simple Explanation)
1307
+
1308
+ ### What This Tool Does
1309
+
1310
+ This application takes a single photograph and creates a 3D model of what's in the picture. It's like going from a flat image to something you can view from different angles.
1311
+
1312
+ **The Basic Process:**
1313
+
1314
+ 1. **Input**: You upload a regular photo (JPG, PNG, etc.)
1315
+ 2. **Analysis**: AI figures out how far away everything is
1316
+ 3. **3D Creation**: Converts the flat image into a 3D shape
1317
+ 4. **Output**: You get an interactive 3D model you can rotate and explore
1318
+
1319
+ ### Why This Is Useful
1320
+
1321
+ **Educational Applications:**
1322
+ - Teaching 3D concepts visually
1323
+ - Demonstrating spatial relationships
1324
+ - Creating interactive presentations
1325
+ - Generating content for projects
1326
+
1327
+ **Documentation:**
1328
+ - Preserving memories in 3D
1329
+ - Recording spaces and objects
1330
+ - Creating digital archives
1331
+ - Sharing spatial information
1332
+
1333
+ **Creative Projects:**
1334
+ - 3D art from photos
1335
+ - Game asset creation
1336
+ - Virtual tours
1337
+ - Visualization projects
1338
+
1339
+ ### The Technology Behind It
1340
+
1341
+ **Step 1: Depth Estimation**
1342
+ - The AI looks at your photo and estimates distance
1343
+ - It learned from thousands of example images
1344
+ - Creates a "depth map" showing near vs far
1345
+ - Like how your brain judges distance with one eye
1346
+
1347
+ **Step 2: 3D Point Creation**
1348
+ - Each pixel becomes a 3D point in space
1349
+ - Points have X, Y, Z coordinates (position)
1350
+ - Points keep their RGB color from the photo
1351
+ - Result: A cloud of colored dots in 3D space
1352
+
1353
+ **Step 3: Surface Creation**
1354
+ - Connects the dots to make a smooth surface
1355
+ - Like connecting the dots in a puzzle
1356
+ - Creates triangles between nearby points
1357
+ - Result: A solid 3D mesh you can view
1358
+
1359
+ ### Two AI Models to Choose From
1360
+
1361
+ **GLPN (Recommended)**
1362
+ - Faster processing (~2-3 seconds)
1363
+ - Good for most photos
1364
+ - Best for: Indoor scenes, buildings, objects
1365
+ - Think of it as: Quick and reliable
1366
+
1367
+ **DPT (High Quality)**
1368
+ - Slower but more accurate (~6-10 seconds)
1369
+ - Better for complex scenes
1370
+ - Best for: Landscapes, detailed scenes
1371
+ - Think of it as: Slower but more precise
1372
+
1373
+ ### What You Get
1374
+
1375
+ **Depth Map Visualization:**
1376
+ - Side-by-side comparison: original photo vs depth
1377
+ - Warmer colors (yellow/red) = closer objects
1378
+ - Cooler colors (blue/purple) = farther objects
1379
+ - Helps you understand the 3D structure
1380
+
1381
+ **Interactive 3D Viewer:**
1382
+ - Rotate: Click and drag to spin around
1383
+ - Zoom: Scroll to get closer or farther
1384
+ - Pan: Right-click and drag to move view
1385
+ - Works right in your web browser
1386
+
1387
+ **Downloadable Files:**
1388
+ - Multiple 3D formats (PLY, OBJ, STL)
1389
+ - Can open in 3D software like Blender
1390
+ - Can be used for 3D printing
1391
+ - Compatible with many programs
1392
+
1393
+ ### Understanding Quality Metrics
1394
+
1395
+ **Point Cloud Size:**
1396
+ - More points = more detail
1397
+ - Typical: 200,000 - 500,000 points
1398
+ - Think of it like: More pixels = clearer image
1399
+
1400
+ **Processing Time:**
1401
+ - Usually 10-30 seconds total
1402
+ - Depends on image size and model choice
1403
+ - Faster with GPU, slower with just CPU
1404
+
1405
+ **Mesh Quality:**
1406
+ - **Vertices**: Corner points of the shape (more = more detail)
1407
+ - **Triangles**: Faces of the shape (how it's built)
1408
+ - **Watertight**: Whether it's a closed solid (important for 3D printing)
1409
+
1410
+ ### Limitations (Important to Know)
1411
+
1412
+ **What This Can't Do:**
1413
+ - ❌ See hidden parts (backside of objects)
1414
+ - ❌ Give exact real-world measurements
1415
+ - ❌ Work well with mirrors or glass
1416
+ - ❌ Reconstruct from blurry photos
1417
+
1418
+ **What This Can Do:**
1419
+ - βœ… Show spatial relationships
1420
+ - βœ… Create viewable 3D models
1421
+ - βœ… Work with regular photos
1422
+ - βœ… Generate exportable files
1423
+
1424
+ ### Best Results Come From:
1425
+
1426
+ **Good Photos:**
1427
+ - Clear, not blurry
1428
+ - Well-lit (daytime or bright lighting)
1429
+ - Shows depth (not flat scenes)
1430
+ - Has texture and detail
1431
+
1432
+ **Photo Types:**
1433
+ - βœ… Rooms with furniture
1434
+ - βœ… Buildings from street level
1435
+ - βœ… Objects on tables
1436
+ - βœ… Outdoor scenes with structures
1437
+
1438
+ **Avoid:**
1439
+ - ❌ Pure white walls (no texture)
1440
+ - ❌ Mirrors or reflective surfaces
1441
+ - ❌ Very dark or overexposed photos
1442
+ - ❌ Motion blur or low resolution
1443
 
1444
+ ### Comparing to Other Methods
1445
+
1446
+ **vs. Taking Multiple Photos:**
1447
+ - Pro: Only need one photo
1448
+ - Con: Less accurate than multiple angles
1449
+ - Use when: You only have one image
1450
+
1451
+ **vs. 3D Scanner:**
1452
+ - Pro: Free, no special equipment
1453
+ - Con: Less precise
1454
+ - Use when: Quick visualization needed
1455
+
1456
+ **vs. Manual 3D Modeling:**
1457
+ - Pro: Automatic, much faster
1458
+ - Con: Less control over details
1459
+ - Use when: Speed is important
1460
+
1461
+ ### File Formats Explained
1462
+
1463
+ **PLY Format:**
1464
+ - Most common for 3D points
1465
+ - Stores color information
1466
+ - Opens in most 3D software
1467
+
1468
+ **OBJ Format:**
1469
+ - Standard 3D format
1470
+ - Very compatible
1471
+ - Good for editing
1472
+
1473
+ **STL Format:**
1474
+ - Used for 3D printing
1475
+ - No color, just shape
1476
+ - Needed for 3D printers
1477
+
1478
+ ### Next Steps After Creating Your Model
1479
+
1480
+ **View It:**
1481
+ - Use the interactive viewer here
1482
+ - Download and open in free software (Blender, MeshLab)
1483
+ - Share the file with others
1484
+
1485
+ **Edit It:**
1486
+ - Import into 3D editing software
1487
+ - Clean up or modify
1488
+ - Add textures or materials
1489
+
1490
+ **Use It:**
1491
+ - 3D print physical objects
1492
+ - Include in presentations
1493
+ - Create virtual tours
1494
+ - Generate game assets
1495
+
1496
+ ### Free Software to View Your 3D Models
1497
+
1498
+ **Blender** (Most Popular)
1499
+ - Free and powerful
1500
+ - Works on Windows, Mac, Linux
1501
+ - Download: blender.org
1502
+
1503
+ **MeshLab** (Simpler)
1504
+ - Good for beginners
1505
+ - View and edit meshes
1506
+ - Download: meshlab.net
1507
+
1508
+ **Online Viewers** (No Installation)
1509
+ - 3dviewer.net
1510
+ - clara.io
1511
+ - Just drag and drop your file
1512
+
1513
+ ### Common Questions
1514
+
1515
+ **Q: Why don't measurements match reality?**
1516
+ A: The tool creates relative sizes, not absolute. To get real measurements, you'd need to add a scale reference.
1517
+
1518
+ **Q: Why is the backside empty?**
1519
+ A: The camera can only see what's in front. Hidden surfaces can't be reconstructed.
1520
+
1521
+ **Q: Can I use this for 3D printing?**
1522
+ A: Yes! Use the STL file. Check if it says "Watertight: βœ“" for best results.
1523
+
1524
+ **Q: Why does it look different from the photo?**
1525
+ A: The tool estimates 3D shape from 2D clues. It's not perfect but gives a good approximation.
1526
+
1527
+ **Q: How accurate is it?**
1528
+ A: Good for visualization and understanding spatial layout. Not suitable for engineering or precise work.
1529
+ """
1530
+
1531
+ ### 3D Reconstruction for Urban Geography
1532
+
1533
+ **Urban Morphology Analysis:**
1534
+ - Digital elevation models (DEMs) from street-level photography
1535
+ - Building facade reconstruction for urban texture analysis
1536
+ - Volumetric analysis of built environments
1537
+ - Spatial pattern recognition in urban landscapes
1538
+
1539
+ **Applications in Urban Planning:**
1540
+ - Rapid assessment of building conditions
1541
+ - Historic preservation documentation
1542
+ - Public space analysis
1543
+ - Visual impact assessments
1544
+ - Community engagement visualizations
1545
+
1546
+ ### Depth Estimation Technology
1547
 
1548
  **GLPN (Global-Local Path Networks)**
1549
+ - Paper: Kim et al., CVPR 2022
1550
+ - Optimized for: Indoor/outdoor architectural scenes
1551
+ - Training: NYU Depth V2 (urban indoor environments)
1552
+ - Best for: Building interiors, street-level views, architectural details
1553
+ - Geographic advantage: Fast processing for field documentation
 
1554
 
1555
  **DPT (Dense Prediction Transformer)**
1556
+ - Paper: Ranftl et al., ICCV 2021
1557
+ - Optimized for: Complex urban scenes
1558
+ - Training: Multiple datasets (urban and natural environments)
1559
+ - Best for: Wide-area urban landscapes, complex built environments
1560
+ - Geographic advantage: Superior accuracy for planning-grade documentation
1561
+
1562
+ ### Spatial Data Pipeline
1563
+
1564
+ Our reconstruction pipeline generates geospatially-relevant data:
1565
+
1566
+ **1. Monocular Depth Estimation**
1567
+ - Challenge: Extracting 3D spatial information from 2D photographs
1568
+ - Application: Similar to photogrammetry but from single images
1569
+ - Output: Relative depth maps for spatial analysis
1570
+ - Use case: Quick field assessment without specialized equipment
1571
+
1572
+ **2. Point Cloud Generation (Spatial Coordinates)**
1573
+ - Creates 3D coordinate system (X, Y, Z) from pixels
1574
+ - Each point: Geographic location + RGB color information
1575
+ - Compatible with: GIS software, CAD tools, spatial databases
1576
+ - Use case: Integration with existing urban datasets
1577
+
1578
+ **3. 3D Mesh Generation (Surface Models)**
1579
+ - Creates continuous surface from discrete points
1580
+ - Similar to: Digital terrain models (DTMs) for buildings
1581
+ - Output formats: Compatible with ArcGIS, QGIS, SketchUp
1582
+ - Use case: 3D city models, urban visualization
1583
+
1584
+ ### Spatial Quality Metrics
1585
+
1586
+ **For Urban Planning Applications:**
1587
+
1588
+ - **Point Cloud Density**: 290K+ points = high spatial resolution
1589
+ - **Geometric Accuracy**: Manifold checks ensure valid topology
1590
+ - **Surface Continuity**: Watertight meshes = complete volume calculations
1591
+ - **Data Fidelity**: Triangle count indicates level of detail
1592
+
1593
+ **Limitations for Geographic Applications:**
1594
+
1595
+ 1. **Scale Ambiguity**: Requires ground control points for absolute measurements
1596
+ 2. **Single Viewpoint**: Cannot capture occluded facades or hidden spaces
1597
+ 3. **No Georeferencing**: Outputs in local coordinates, not global (lat/lon)
1598
+ 4. **Weather Dependent**: Best results with clear, well-lit conditions
1599
+
1600
+ ### Comparison with Traditional Geospatial Methods
1601
+
1602
+ **vs. Terrestrial Laser Scanning (TLS):**
1603
+ - Pro: Much cheaper, faster, more accessible
1604
+ - Con: Lower accuracy, no absolute scale
1605
+ - Use case: Preliminary surveys, community documentation
1606
+
1607
+ **vs. Photogrammetry (Structure-from-Motion):**
1608
+ - Pro: Works with single image, faster processing
1609
+ - Con: Less accurate, cannot resolve scale
1610
+ - Use case: Quick assessments, emergency documentation
1611
+
1612
+ **vs. Aerial/Drone Imagery:**
1613
+ - Pro: Works at street level, captures facades
1614
+ - Con: Limited coverage area, ground-level perspective only
1615
+ - Use case: Pedestrian-scale analysis, building details
1616
+
1617
+ **vs. LiDAR:**
1618
+ - Pro: Much lower cost, consumer cameras sufficient
1619
+ - Con: Lower precision, no absolute measurements
1620
+ - Use case: Educational purposes, preliminary studies
1621
+
1622
+ ### Urban Planning Applications
1623
+
1624
+ **1. Heritage & Cultural Documentation**
1625
+ - Document historic buildings before renovation
1626
+ - Create virtual archives of cultural sites
1627
+ - Community participation through simple photography
1628
+ - Low-cost alternative to professional surveys
1629
+
1630
+ **2. Urban Design Visualization**
1631
+ - Visualize existing conditions in 3D
1632
+ - Communicate proposals to stakeholders
1633
+ - Analyze shadow impacts and sightlines
1634
+ - Virtual walkthroughs for community feedback
1635
+
1636
+ **3. Housing & Building Assessment**
1637
+ - Rapid condition surveys
1638
+ - Informal settlement documentation
1639
+ - Building envelope analysis
1640
+ - Slum upgrading planning
1641
+
1642
+ **4. Public Space Analysis**
1643
+ - Document plazas, parks, streetscapes
1644
+ - Analyze spatial enclosure
1645
+ - Assess accessibility features
1646
+ - Before/after comparisons for interventions
1647
+
1648
+ **5. Participatory Planning**
1649
+ - Enable community members to document their neighborhoods
1650
+ - Low barrier to entry (smartphone photos)
1651
+ - Inclusive data collection
1652
+ - Bottom-up spatial data generation
1653
+
1654
+ **6. Disaster Response & Resilience**
1655
+ - Rapid damage assessment
1656
+ - Pre-disaster documentation
1657
+ - Emergency shelter planning
1658
+ - Recovery monitoring
1659
+
1660
+ ### Integration with GIS
1661
+
1662
+ **Workflow for Urban Planners:**
1663
+
1664
+ 1. **Capture**: Photograph urban scenes with standard camera
1665
+ 2. **Process**: Generate 3D model using this tool
1666
+ 3. **Export**: Download PLY/OBJ files
1667
+ 4. **Import**: Load into QGIS, ArcGIS Pro, or SketchUp
1668
+ 5. **Georeference**: Add ground control points for absolute positioning
1669
+ 6. **Analyze**: Perform spatial analysis with other urban datasets
1670
+ 7. **Visualize**: Create 3D city models or planning scenarios
1671
+
1672
+ **Compatible Software:**
1673
+ - **QGIS**: Import point clouds for 3D visualization
1674
+ - **ArcGIS Pro**: Integrate with urban datasets
1675
+ - **SketchUp**: Building modeling and visualization
1676
+ - **CloudCompare**: Point cloud analysis
1677
+ - **MeshLab**: Mesh processing and measurements
1678
+
1679
+ ### Research Applications in Geography
1680
+
1681
+ **Urban Morphology Studies:**
1682
+ - Building height-to-width ratios
1683
+ - Street canyon analysis
1684
+ - Urban density measurements
1685
+ - Facade complexity metrics
1686
+
1687
+ **Social Geography:**
1688
+ - Document vernacular architecture
1689
+ - Study neighborhood characteristics
1690
+ - Analyze gentrification patterns
1691
+ - Community asset mapping
1692
+
1693
+ **Environmental Geography:**
1694
+ - Urban heat island analysis (surface geometry)
1695
+ - Wind flow modeling (building arrangements)
1696
+ - Green space visibility studies
1697
+ - Urban ecology habitat assessment
1698
+
1699
+ **Historical Geography:**
1700
+ - Track urban change over time
1701
+ - Document disappearing landscapes
1702
+ - Preserve architectural heritage
1703
+ - Study urban development patterns
1704
+
1705
+ ### Limitations for Professional Practice
1706
+
1707
+ **Not Suitable For:**
1708
+ - ❌ Legal surveys or cadastral mapping
1709
+ - ❌ Engineering-grade measurements
1710
+ - ❌ Official building permits
1711
+ - ❌ Structural analysis
1712
+
1713
+ **Appropriate For:**
1714
+ - βœ… Preliminary assessments
1715
+ - βœ… Educational purposes
1716
+ - βœ… Community engagement
1717
+ - βœ… Concept visualization
1718
+ - βœ… Research documentation
1719
+ - βœ… Public outreach
1720
+
1721
+ ### Future Directions in Urban Geospatial Technology
1722
+
1723
+ 1. **Multi-temporal Analysis**: Track urban change with time-series images
1724
+ 2. **Semantic Segmentation**: Automatic identification of urban features
1725
+ 3. **Scale Recovery**: Integration with GPS/mapping data for absolute scale
1726
+ 4. **Mobile Integration**: Real-time reconstruction on smartphones
1727
+ 5. **Collaborative Mapping**: Community-contributed 3D city models
1728
+ 6. **Climate Adaptation**: Shadow analysis, ventilation studies
1729
+ 7. **Equity Mapping**: Document underrepresented neighborhoods
1730
  """
1731
 
1732
  # ============================================================================
 
1952
  'is_watertight': mesh.is_watertight(),
1953
  }
1954
 
1955
+ # Compute surface area safely with multiple methods
1956
+ surface_area_computed = False
1957
  try:
1958
  surface_area = mesh.get_surface_area()
1959
+ print(f"Surface area (Open3D method): {surface_area}")
1960
+ if surface_area > 0:
1961
+ metrics['surface_area'] = float(surface_area)
1962
+ surface_area_computed = True
1963
+ else:
1964
+ print("Open3D returned 0, trying manual calculation...")
1965
  except Exception as e:
1966
+ print(f"Open3D surface area failed: {e}")
1967
+
1968
+ # Fallback: Manual triangle area calculation
1969
+ if not surface_area_computed:
1970
+ try:
1971
+ vertices = np.asarray(mesh.vertices)
1972
+ triangles = np.asarray(mesh.triangles)
1973
+
1974
+ # Get vertices for each triangle
1975
+ v0 = vertices[triangles[:, 0]]
1976
+ v1 = vertices[triangles[:, 1]]
1977
+ v2 = vertices[triangles[:, 2]]
1978
+
1979
+ # Calculate area using cross product
1980
+ cross = np.cross(v1 - v0, v2 - v0)
1981
+ areas = 0.5 * np.linalg.norm(cross, axis=1)
1982
+ total_area = np.sum(areas)
1983
+
1984
+ print(f"Surface area (manual calculation): {total_area}")
1985
+ metrics['surface_area'] = float(total_area)
1986
+ surface_area_computed = True
1987
+ except Exception as e:
1988
+ print(f"Manual surface area calculation failed: {e}")
1989
+ metrics['surface_area'] = "Unable to compute"
1990
+
1991
+ if not surface_area_computed:
1992
  metrics['surface_area'] = "Unable to compute"
1993
 
1994
  # Compute volume only if watertight
 
2003
  metrics['volume'] = None
2004
 
2005
  print("Metrics computed!")
2006
+ print(f"Final surface area: {metrics['surface_area']}")
2007
  print(f"Edge manifold: {metrics['is_edge_manifold']}")
2008
  print(f"Watertight: {metrics['is_watertight']}")
2009
 
 
2111
  print("Files exported!")
2112
 
2113
  # Create metrics report
2114
+ assessment = _generate_quality_assessment(metrics)
2115
+
2116
  report = f"""
2117
  ## Reconstruction Complete! βœ…
2118
 
 
2137
  - **Volume**: {f"{metrics['volume']:.2f}" if metrics.get('volume') else 'N/A (not watertight)'}
2138
 
2139
  ### Quality Assessment
2140
+ {assessment}
2141
 
2142
  ### Files Exported
2143
  - Point Cloud: PLY format
 
2163
  with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as demo:
2164
 
2165
  gr.Markdown("""
2166
+ # πŸ—οΈ 3D Reconstruction from Single Images
2167
+
2168
+ **Transform any photograph into an interactive 3D model**
2169
 
2170
+ Upload a photo to automatically generate:
2171
+ - **Depth maps** showing distance from camera
2172
+ - **3D point clouds** with spatial coordinates
2173
+ - **3D meshes** that can be viewed and exported
2174
+ - **Interactive visualization** you can rotate and explore
2175
 
2176
+ No special equipment needed - works with any regular photograph!
 
 
 
 
 
2177
  """)
2178
 
2179
  with gr.Tabs():
 
2280
  """)
2281
 
2282
  # ========== USAGE GUIDE TAB ==========
2283
+ with gr.Tab("πŸ“– Step-by-Step Guide"):
2284
+ gr.Markdown("""
2285
+ ## How to Use This Application
2286
+
2287
+ ### Quick Start (3 Simple Steps)
2288
+
2289
+ 1. **Upload a Photo** β†’ Click the upload area
2290
+ 2. **Click "Start Reconstruction"** β†’ Wait 20-30 seconds
2291
+ 3. **Explore Your 3D Model** β†’ Rotate, zoom, download
2292
+
2293
+
2294
+ ---
2295
+
2296
+ ### Detailed Instructions
2297
+
2298
+ #### Step 1: Choose Your Photo
2299
+
2300
+ **What makes a good photo:**
2301
+ - βœ… Clear and in focus
2302
+ - βœ… Good lighting (daytime or bright indoors)
2303
+ - βœ… Shows some depth (not a flat wall)
2304
+ - βœ… Has details and texture
2305
+
2306
+ **Examples of good photos:**
2307
+ - A room with furniture
2308
+ - A building from the street
2309
+ - A table with objects on it
2310
+ - An outdoor scene with trees and structures
2311
+
2312
+ **Photos to avoid:**
2313
+ - ❌ Very blurry or dark
2314
+ - ❌ Just a blank wall
2315
+ - ❌ Mirrors or shiny surfaces
2316
+ - ❌ Extreme close-ups
2317
+
2318
+ ---
2319
+
2320
+ #### Step 2: Upload Your Image
2321
+
2322
+ 1. Click on the **"Upload Image"** box
2323
+ 2. Select a JPG, PNG, or BMP file from your computer
2324
+ 3. Wait for it to appear in the box
2325
+ 4. You should see a preview of your photo
2326
+
2327
+ **Tip**: Photos between 500-2000 pixels wide work best
2328
+
2329
+ ---
2330
+
2331
+ #### Step 3: Choose Settings (Optional)
2332
+
2333
+ **Model Selection:**
2334
+
2335
+ - **GLPN (Recommended)**
2336
+ - Faster (2-3 seconds)
2337
+ - Good for most photos
2338
+ - Choose this if unsure
2339
+
2340
+ - **DPT (High Quality)**
2341
+ - Slower (6-10 seconds)
2342
+ - Better quality
2343
+ - Choose for important projects
2344
+
2345
+ **Visualization Type:**
2346
+
2347
+ - **Mesh** (default) - Smooth solid surface
2348
+ - **Point Cloud** - Individual colored dots
2349
+ - **Both** - See both representations
2350
+
2351
+ ---
2352
+
2353
+ #### Step 4: Generate 3D Model
2354
+
2355
+ 1. Click the big **"πŸš€ Start Reconstruction"** button
2356
+ 2. Wait while it processes (watch the status)
2357
+ 3. Processing typically takes 10-30 seconds
2358
+
2359
+ **What's happening:**
2360
+ - Analyzing your photo for depth
2361
+ - Creating 3D points in space
2362
+ - Building a surface mesh
2363
+ - Generating visualization
2364
+
2365
+ ---
2366
+
2367
+ #### Step 5: View Your Results
2368
+
2369
+ **You'll see four outputs:**
2370
+
2371
+ **1. Depth Map Comparison**
2372
+ - Left side: Your original photo
2373
+ - Right side: Colored depth map
2374
+ - Yellow/Red = Close to camera
2375
+ - Blue/Purple = Far from camera
2376
+
2377
+ **2. Interactive 3D Viewer**
2378
+ - **Rotate**: Click and drag left/right
2379
+ - **Zoom**: Use mouse wheel
2380
+ - **Pan**: Right-click and drag
2381
+ - **Reset**: Double-click anywhere
2382
+
2383
+ **3. Quality Report**
2384
+ - Processing time
2385
+ - Number of 3D points
2386
+ - Mesh statistics
2387
+ - Quality assessment
2388
+
2389
+ **4. Download Files (ZIP)**
2390
+ - Contains all 3D file formats
2391
+ - Quality metrics in JSON
2392
+
2393
+ ---
2394
+
2395
+ ### Understanding Your Results
2396
+
2397
+ #### The Depth Map
2398
+
2399
+ This shows how far everything is from the camera:
2400
+ - **Warmer colors** (yellow, orange, red) = closer objects
2401
+ - **Cooler colors** (blue, purple) = farther objects
2402
+ - It's like a heat map for distance!
2403
+
2404
+ #### The 3D Viewer
2405
+
2406
+ You can explore your model from any angle:
2407
+ - Spin it around to see different sides
2408
+ - Zoom in to see details
2409
+ - Zoom out to see the whole scene
2410
+ - It's like holding the object in your hands
2411
+
2412
+ #### Quality Metrics Explained
2413
+
2414
+ **Processing Time:**
2415
+ - How long it took to create the model
2416
+ - Typically 10-30 seconds
2417
+ - Longer for larger images or DPT model
2418
+
2419
+ **Point Count:**
2420
+ - How many 3D points were created
2421
+ - More points = more detail
2422
+ - Typical range: 200,000 - 500,000 points
2423
+
2424
+ **Mesh Quality:**
2425
+ - **Vertices**: Number of corner points
2426
+ - **Triangles**: How many faces the shape has
2427
+ - **Watertight**: Whether it's a closed solid
2428
+ - βœ“ = Good for 3D printing
2429
+ - βœ— = Has some openings (still usable)
2430
+
2431
+ ---
2432
+
2433
+ ### Downloading Your 3D Model
2434
+
2435
+ #### What's in the ZIP File?
2436
+
2437
+ When you download, you get 5 files:
2438
+
2439
+ 1. **point_cloud.ply** - The colored 3D points
2440
+ 2. **mesh.ply** - The solid surface (with color)
2441
+ 3. **mesh.obj** - Standard 3D format (most compatible)
2442
+ 4. **mesh.stl** - For 3D printing (no color)
2443
+ 5. **metrics.json** - Statistics about the model
2444
+
2445
+ #### Opening Your Files
2446
+
2447
+ **Free Software Options:**
2448
+
2449
+ **Blender** (Recommended for most users)
2450
+ - Download: blender.org
2451
+ - File β†’ Import β†’ Wavefront (.obj)
2452
+ - Full featured 3D software
2453
+
2454
+ **MeshLab** (Simpler alternative)
2455
+ - Download: meshlab.net
2456
+ - Just drag and drop files
2457
+ - Good for viewing and basic editing
2458
+
2459
+ **Online Viewers** (No installation needed)
2460
+ - Visit: 3dviewer.net
2461
+ - Drag your OBJ or PLY file onto the page
2462
+ - View immediately in your browser
2463
+
2464
+ ---
2465
+
2466
+
2467
+ ### Troubleshooting Common Issues
2468
+
2469
+ #### Problem: "No output appears"
2470
+ **Solutions:**
2471
+ - Refresh the page and try again
2472
+ - Try a smaller image (under 2000px)
2473
+ - Make sure image uploaded correctly
2474
+ - Check internet connection
2475
+
2476
+ #### Problem: "Depth map looks strange"
2477
+ **Causes:**
2478
+ - Photo has mirrors or glass (creates confusion)
2479
+ - Photo is too dark or overexposed
2480
+ - Subject is too uniform (blank wall)
2481
+
2482
+ **Solutions:**
2483
+ - Try a different photo
2484
+ - Use a photo with more texture and depth
2485
+ - Ensure good lighting
2486
+
2487
+ #### Problem: "3D model has holes"
2488
+ **This is normal!**
2489
+ - The camera can only see one side
2490
+ - Hidden surfaces can't be reconstructed
2491
+ - This is expected behavior
2492
+ - The model is still usable
2493
+
2494
+ #### Problem: "Processing is slow"
2495
+ **Normal behavior:**
2496
+ - First time using DPT: Takes longer (downloading model)
2497
+ - Large images: Take more time
2498
+ - Typical range: 10-60 seconds
2499
+
2500
+ #### Problem: "Colors look wrong"
2501
+ **Explanation:**
2502
+ - Mesh colors are interpolated from photos
2503
+ - Not exact but approximate
2504
+ - Point cloud colors are more accurate
2505
+ - This is a technical limitation
2506
+
2507
+ ---
2508
+
2509
+ ### Tips for Best Results
2510
+
2511
+ #### Photography Tips:
2512
+
2513
+ **Lighting:**
2514
+ - Use natural daylight when possible
2515
+ - Avoid harsh shadows
2516
+ - Indoor: Turn on room lights
2517
+ - Outdoor: Overcast days work well
2518
+
2519
+ **Camera Position:**
2520
+ - Hold camera level (not tilted)
2521
+ - Step back to include whole scene
2522
+ - Don't get too close
2523
+ - Include some context around main subject
2524
+
2525
+ **Subject Selection:**
2526
+ - Choose scenes with depth
2527
+ - Include objects at different distances
2528
+ - Look for texture and detail
2529
+ - Avoid very flat scenes
2530
+
2531
+ #### What Works Well:
2532
+
2533
+ - βœ… Living rooms with furniture
2534
+ - βœ… Outdoor buildings
2535
+ - βœ… Desks with items on them
2536
+ - βœ… Kitchen scenes
2537
+ - βœ… Gardens with plants
2538
+ - βœ… Street scenes
2539
+
2540
+ #### What Doesn't Work:
2541
+
2542
+ - ❌ Blank white walls
2543
+ - ❌ Mirrors and reflective surfaces
2544
+ - ❌ Very dark rooms
2545
+ - ❌ Photos through windows
2546
+ - ❌ Extreme close-ups
2547
+ - ❌ Moving subjects (blur)
2548
+
2549
+ ---
2550
+
2551
+ ### Learning More
2552
+
2553
+ **If you want to go deeper:**
2554
+
2555
+ - Check the "How It Works" tab for technical details
2556
+ - Learn Blender for 3D editing (blender.org/tutorials)
2557
+ - Experiment with different photo types
2558
+ - Try both models and compare results
2559
+
2560
+ **Remember**: This is a learning tool. Have fun, experiment, and don't worry about making mistakes!
2561
+ """)
2562
+ gr.Markdown("""
2563
+
2564
+ ## Tips for Urban Documentation
2565
+
2566
+ ### βœ… DO:
2567
+ - Photograph during daytime with good natural light
2568
+ - Include full height of buildings when possible
2569
+ - Capture street-level perspective (pedestrian view)
2570
+ - Document both built form and public space
2571
+ - Take photos perpendicular to main facades
2572
+ - Include contextual elements (trees, furniture, people)
2573
+ - Maintain consistent camera height when documenting corridors
2574
+
2575
+ ### ❌ AVOID:
2576
+ - Heavy shadows (early morning/late evening)
2577
+ - Reflective glass facades (creates depth errors)
2578
+ - Moving vehicles or people in foreground
2579
+ - Extreme angles (very high or low)
2580
+ - Rainy or foggy conditions
2581
+ - Nighttime or artificial lighting only
2582
+ - Obstruction by trees or street furniture
2583
+
2584
+
2585
+
2586
+ ## Troubleshooting Urban Scenes
2587
+
2588
+ **Issue: Poor depth on glass buildings**
2589
+ - Solution: Photograph on overcast days (reduces reflections)
2590
+ - Alternative: Focus on non-reflective adjacent structures
2591
+
2592
+ **Issue: Trees obscure buildings**
2593
+ - Solution: Document in winter (deciduous trees)
2594
+ - Alternative: Multiple angles from different positions
2595
+
2596
+ **Issue: Busy street with traffic**
2597
+ - Solution: Photograph during quiet times
2598
+ - Alternative: Focus on pedestrian areas
2599
+
2600
+ **Issue: Very tall buildings**
2601
+ - Solution: Step back to include full height
2602
+ - Alternative: Document sections separately
2603
+
2604
+ **Issue: Narrow streets (limited view)**
2605
+ - Solution: Multiple overlapping photos
2606
+ - Alternative: Focus on key elements
2607
+
2608
+ ## Quality Interpretation for Planners
2609
+
2610
+ ### Point Cloud Statistics:
2611
+ - **300K+ points**: Excellent detail for analysis
2612
+ - **3-5% outliers**: Normal, indicates clean data
2613
+ - **<3% outliers**: Very high quality capture
2614
+
2615
+ ### Mesh Quality:
2616
+ - **Watertight βœ“**: Can calculate volumes (building bulk)
2617
+ - **Watertight βœ—**: Surface only (most common for facades)
2618
+ - **High triangle count**: Very detailed model
2619
+ - **Surface area**: Useful for material estimates
2620
+
2621
+ ### Processing Time:
2622
+ - Typical: 15-30 seconds per image
2623
+ - Acceptable for field documentation
2624
+ - Consider batch processing for large areas
2625
+
2626
+ ## Advanced Applications
2627
+
2628
+ ### Multi-temporal Analysis:
2629
+ - Document same location over months/years
2630
+ - Track urban change
2631
+ - Monitor construction progress
2632
+ - Assess intervention impacts
2633
+ - Study gentrification patterns
2634
+
2635
+ ### Participatory Mapping:
2636
+ - Train community members
2637
+ - Collect distributed data
2638
+ - Map neighborhood assets
2639
+ - Document vernacular architecture
2640
+ - Create collective memory
2641
+
2642
+ ### Urban Morphology Research:
2643
+ - Building typology classification
2644
+ - Density calculations
2645
+ - Form-based analysis
2646
+ - Pattern recognition
2647
+ - Comparative urban studies
2648
+
2649
+ ### Climate Adaptation Planning:
2650
+ - Document green infrastructure
2651
+ - Assess shade provision
2652
+ - Plan heat mitigation
2653
+ - Evaluate flood vulnerability
2654
+ - Design cooling corridors
2655
+
2656
+
2657
+ """)
2658
  gr.Markdown("""
2659
  ## How to Use This Application
2660
 
 
2738
  - https://www.creators3d.com/online-viewer
2739
  - Just drag and drop your OBJ/PLY file
2740
 
 
 
 
 
 
 
2741
 
2742
  ## Tips for Best Results
2743
 
 
2833
  """)
2834
 
2835
  # ========== CITATION TAB ==========
2836
+ with gr.Tab("πŸ“„ References & Credits"):
2837
  gr.Markdown("""
2838
+ ## Academic Citations
2839
+
2840
+
2841
+ ### Computer Vision Methods:
2842
+
2843
+ **For GLPN Model:**
2844
+ ```bibtex
2845
+ @inproceedings{kim2022global,
2846
+ title={Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepth},
2847
+ author={Kim, Doyeon and Ga, Woonghyun and Ahn, Pyungwhan and Joo, Donggyu and Chun, Sehwan and Kim, Junmo},
2848
+ booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
2849
+ pages={8777--8787},
2850
+ year={2022}
2851
+ }
2852
+ ```
2853
+
2854
+ **For DPT Model:**
2855
+ ```bibtex
2856
+ @inproceedings{ranftl2021vision,
2857
+ title={Vision Transformers for Dense Prediction},
2858
+ author={Ranftl, Ren{\'e} and Bochkovskiy, Alexey and Koltun, Vladlen},
2859
+ booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
2860
+ pages={12179--12188},
2861
+ year={2021}
2862
+ }
2863
+ ```
2864
+
2865
+ **For Poisson Reconstruction:**
2866
+ ```bibtex
2867
+ @inproceedings{kazhdan2006poisson,
2868
+ title={Poisson Surface Reconstruction},
2869
+ author={Kazhdan, Michael and Bolitho, Matthew and Hoppe, Hugues},
2870
+ booktitle={Proceedings of the fourth Eurographics symposium on Geometry processing},
2871
+ volume={7},
2872
+ year={2006}
2873
+ }
2874
+ ```
2875
+
2876
+
2877
+
2878
+ ## Open Source Software
2879
+
2880
+ This application is built with:
2881
+
2882
+ **Core Technologies:**
2883
+ - **Transformers** (Hugging Face): Deep learning model inference
2884
+ - **Open3D**: 3D geometry processing and point cloud analysis
2885
+ - **PyTorch**: Machine learning framework
2886
+ - **Plotly**: Interactive 3D visualization
2887
+ - **Gradio**: Web application framework
2888
+
2889
+ **Supporting Libraries:**
2890
+ - **NumPy & SciPy**: Numerical computing
2891
+ - **Matplotlib**: Data visualization
2892
+ - **Pillow**: Image processing
2893
+
2894
+ **Compatible GIS Software:**
2895
+ - **QGIS**: Free and open source GIS
2896
+ - **ArcGIS Pro**: Professional GIS platform
2897
+ - **CloudCompare**: Point cloud processing
2898
+ - **MeshLab**: Mesh processing and editing
2899
+ - **SketchUp**: 3D modeling for design
2900
+ - **Blender**: Complete 3D creation suite
2901
+
2902
+ ## License & Usage
2903
+
2904
+
2905
+ **Model Licenses:**
2906
+ - GLPN: Apache 2.0 License
2907
+ - DPT: MIT License
2908
+ - Check Hugging Face model cards for details
2909
 
2910
+ **Generated Outputs:**
2911
+ - You own all 3D models generated
2912
+ - Free to use in publications, presentations, reports
2913
+ - Suitable for academic and professional work
2914
+ - Can be shared publicly or kept private
2915
+
2916
+
2917
+
2918
+
2919
+ ## Future Development
2920
+
2921
+ **Planned Enhancements:**
2922
+ - Georeferencing integration
2923
+ - Batch processing capabilities
2924
+ - Mobile app version
2925
+ - Real-time processing
2926
+ - Multi-language support
2927
+
2928
+ **Research Opportunities:**
2929
+ - Integration with social data
2930
+ - Machine learning for urban features
2931
+ - Temporal change detection
2932
+ - Climate adaptation tools
2933
+ - Community data platforms
2934
+
2935
+ ---
2936
+ """)
2937
+ gr.Markdown("""
2938
+
2939
 
2940
  ### For GLPN Model:
2941
  ```bibtex
 
2966
  - **Plotly**: Interactive 3D visualization
2967
  - **Gradio**: Web interface
2968
 
 
 
 
 
 
 
 
 
2969
  """)
2970
 
2971
  # ========== FOOTER ==========
2972
  gr.Markdown("""
2973
  ---
2974
 
2975
+ This application demonstrates:
2976
+ - **Artificial Intelligence**: Deep learning for depth estimation
2977
+ - **Computer Vision**: Understanding 3D from 2D images
2978
+ - **3D Graphics**: Point clouds and mesh generation
2979
+ - **Software Development**: Building user-friendly applications
2980
+ - **Practical Applications**: Making complex technology accessible
2981
 
2982
+ **Created to show how AI can solve real-world problems in an accessible way**
 
 
 
 
2983
 
2984
+ *Combining machine learning, computer graphics, and web technology*
2985
+
2986
+ ---
2987
 
2988
+ **Ready to try it? Upload a photo and click "Start Reconstruction"!** πŸš€
2989
  """)
2990
 
2991
  # ============================================================================