Tohru127 commited on
Commit
401431d
Β·
verified Β·
1 Parent(s): 6a3fc00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +280 -1900
app.py CHANGED
@@ -1,1285 +1,4 @@
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,230 +22,7 @@ import zipfile
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
 
@@ -2163,17 +659,18 @@ def process_image(image, model_choice="GLPN (Recommended)", visualization_type="
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,286 +777,178 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
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
 
@@ -2581,7 +970,33 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
2581
  - Nighttime or artificial lighting only
2582
  - Obstruction by trees or street furniture
2583
 
2584
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2585
 
2586
  ## Troubleshooting Urban Scenes
2587
 
@@ -2653,7 +1068,59 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
2653
  - Evaluate flood vulnerability
2654
  - Design cooling corridors
2655
 
2656
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2657
  """)
2658
  gr.Markdown("""
2659
  ## How to Use This Application
@@ -2738,6 +1205,12 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
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,109 +1306,11 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
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,26 +1341,31 @@ with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as de
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
  # ============================================================================
 
1
+ """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  Advanced 3D Reconstruction from Single Images
3
  Academic-grade pipeline with quality metrics, multiple export formats, and interactive visualization
4
  """
 
22
  # LITERATURE REVIEW & THEORETICAL BACKGROUND
23
  # ============================================================================
24
  THEORY_TEXT = """
25
+ ## Theoretical Background: Geospatial Applications
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ### 3D Reconstruction for Urban Geography
28
 
 
659
  with gr.Blocks(title="Advanced 3D Reconstruction", theme=gr.themes.Soft()) as demo:
660
 
661
  gr.Markdown("""
662
+ # πŸ—οΈ 3D Urban Reconstruction from Single Images
663
 
664
+ **Geospatial Technology for Urban Planning & Analysis**
665
 
666
+ Transform 2D photographs into 3D spatial models for:
667
+ - Urban morphology analysis
668
+ - Built environment assessment
669
+ - Heritage documentation
670
+ - Spatial planning visualization
671
+ - Geographic information systems (GIS) integration
672
 
673
+ Upload a photograph to generate interactive 3D models with exportable spatial data.
674
  """)
675
 
676
  with gr.Tabs():
 
777
  """)
778
 
779
  # ========== USAGE GUIDE TAB ==========
780
+ with gr.Tab("πŸ“– Usage Guide for Urban Planners"):
781
  gr.Markdown("""
782
+ ## How to Use This Tool for Urban Analysis
783
+
784
+ ### Step 1: Capture Urban Photographs
785
+ - Use any digital camera or smartphone
786
+ - Recommended: Street-level views of buildings, public spaces, neighborhoods
787
+ - Best conditions: Daylight, clear weather, minimal shadows
788
+ - **Urban Planning Examples:**
789
+ - Building facades for heritage documentation
790
+ - Street sections for walkability analysis
791
+ - Public spaces for design assessment
792
+ - Informal settlements for upgrading planning
793
+ - Commercial districts for economic analysis
794
+
795
+ ### Step 2: Choose Processing Model
796
+ - **GLPN (Recommended for most urban scenes)**
797
+ - Fast processing (~2-3 seconds)
798
+ - Optimized for architectural scenes
799
+ - Best for: Building interiors, street views, single structures
800
+ - Use when: Time is limited, field documentation
801
+
802
+ - **DPT (High Quality for complex scenes)**
803
+ - Superior quality (~6-10 seconds)
804
+ - Better for wide urban landscapes
805
+ - Best for: Plazas, parks, urban squares, panoramic views
806
+ - Use when: Quality is priority, detailed analysis needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
807
 
808
+ ### Step 3: Select Visualization
809
+ - **Mesh**: Best for volumetric analysis, surface continuity
810
+ - **Point Cloud**: Best for integration with GIS, spatial analysis
811
+ - **Both**: Complete documentation showing both representations
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
812
 
813
+ ### Step 4: Generate 3D Model
814
+ - Click "πŸš€ Start Reconstruction"
815
+ - Processing time: 10-30 seconds typically
816
+ - Watch progress in the report
 
 
817
 
818
+ ### Step 5: Analyze Results
819
 
820
+ **Depth Map Analysis:**
821
+ - Left: Original photograph
822
+ - Right: Spatial depth information
823
+ - **Yellow/Red**: Foreground elements (closer objects)
824
+ - **Blue/Purple**: Background elements (distant features)
825
+ - **Urban Planning Use**: Identify spatial relationships, understand enclosure
826
 
827
+ **Interactive 3D Viewer:**
828
+ - Rotate: Click and drag (view from any angle)
829
+ - Zoom: Scroll wheel (examine details)
830
+ - Pan: Right-click drag (navigate the scene)
831
+ - **Planning Use**: Assess massing, sightlines, spatial quality
832
+
833
+ **Quality Metrics for Planners:**
834
+ - **Point Cloud Density**: Higher = more spatial detail
835
+ - **Watertight Status**: Important if calculating volumes
836
+ - **Triangle Count**: Indicates level of geometric detail
837
+
838
+ ### Step 6: Export for GIS Integration
839
+
840
+ Download the ZIP file containing:
841
+ - **point_cloud.ply** β†’ Import into QGIS, ArcGIS Pro
842
+ - **mesh.ply** β†’ Import into SketchUp, Blender
843
+ - **mesh.obj** β†’ Universal format for most GIS/CAD software
844
+ - **mesh.stl** β†’ For 3D printing physical models
845
+ - **metrics.json** β†’ Spatial data attributes
846
+
847
+ ## Integration Workflows
848
+
849
+ ### Workflow 1: QGIS Integration
850
+ 1. Download point cloud (.ply)
851
+ 2. Open QGIS β†’ Add Layer β†’ Add Point Cloud Layer
852
+ 3. Apply styling for elevation/color
853
+ 4. Overlay with city basemap
854
+ 5. Add ground control points for georeferencing
855
+ 6. Export as georeferenced 3D layer
856
+
857
+ ### Workflow 2: ArcGIS Pro Urban Analysis
858
+ 1. Download mesh (.obj)
859
+ 2. ArcGIS Pro β†’ Insert β†’ Import 3D Object
860
+ 3. Position in local scene
861
+ 4. Add attribute data
862
+ 5. Perform viewshed, shadow analysis
863
+ 6. Create presentation layouts
864
+
865
+ ### Workflow 3: SketchUp Urban Design
866
+ 1. Download mesh (.obj)
867
+ 2. SketchUp β†’ File β†’ Import
868
+ 3. Place in urban context model
869
+ 4. Add textures, refine geometry
870
+ 5. Test design alternatives
871
+ 6. Export renderings for stakeholders
872
+
873
+ ### Workflow 4: Community Engagement
874
+ 1. Generate 3D models of neighborhood
875
+ 2. View in interactive viewer
876
+ 3. Show existing conditions
877
+ 4. Discuss proposed changes
878
+ 5. Document community feedback
879
+ 6. Create before/after comparisons
880
+
881
+ ## Urban Planning Use Cases
882
+
883
+ ### Heritage Conservation
884
+ **Workflow:**
885
+ - Photograph historic buildings
886
+ - Generate 3D documentation
887
+ - Archive for future reference
888
+ - Monitor deterioration over time
889
+ - Support renovation planning
890
+
891
+ **Best Practices:**
892
+ - Multiple views of each facade
893
+ - Consistent lighting conditions
894
+ - Include architectural details
895
+ - Document surroundings
896
+
897
+ ### Informal Settlement Documentation
898
+ **Workflow:**
899
+ - Community members photograph homes
900
+ - Generate spatial database
901
+ - Map infrastructure needs
902
+ - Plan upgrading interventions
903
+ - Track improvements
904
 
905
+ **Benefits:**
906
+ - Participatory data collection
907
+ - Low cost, accessible technology
908
+ - Empowers residents
909
+ - Creates permanent record
910
 
911
+ ### Public Space Analysis
912
+ **Workflow:**
913
+ - Document plaza, park, or street
914
+ - Analyze spatial enclosure
915
+ - Measure sight lines
916
+ - Assess accessibility
917
+ - Evaluate design quality
918
+
919
+ **Metrics to Extract:**
920
+ - Width-to-height ratios
921
+ - Visual complexity
922
+ - Surface areas
923
+ - Volumetric data
924
+
925
+ ### Urban Design Review
926
+ **Workflow:**
927
+ - Photograph proposed site
928
+ - Generate existing conditions model
929
+ - Import to design software
930
+ - Test massing alternatives
931
+ - Visualize proposals in context
932
+
933
+ **Communication:**
934
+ - Show community stakeholders
935
+ - Present to planning commission
936
+ - Public hearings
937
+ - Online participation
938
+
939
+ ### Climate & Sustainability
940
+ **Workflow:**
941
+ - Document building envelopes
942
+ - Analyze orientation
943
+ - Study shadow patterns
944
+ - Assess green infrastructure
945
+ - Plan adaptation measures
946
+
947
+ **Analysis Opportunities:**
948
+ - Solar potential (with georeferencing)
949
+ - Urban heat island effects
950
+ - Natural ventilation paths
951
+ - Green space visibility
952
 
953
  ## Tips for Urban Documentation
954
 
 
970
  - Nighttime or artificial lighting only
971
  - Obstruction by trees or street furniture
972
 
973
+ ## Limitations for Professional Practice
974
+
975
+ ### ⚠️ Important Disclaimers:
976
+
977
+ **This tool is NOT suitable for:**
978
+ - Legal property surveys
979
+ - Structural engineering analysis
980
+ - Official building permits
981
+ - Cadastral mapping
982
+ - Precise measurements (no absolute scale)
983
+ - Archaeological site recording (use TLS)
984
+
985
+ **This tool IS suitable for:**
986
+ - Preliminary site assessments
987
+ - Community documentation
988
+ - Educational purposes
989
+ - Participatory planning
990
+ - Conceptual visualization
991
+ - Research and analysis
992
+ - Public engagement
993
+ - Rapid assessment after disasters
994
+
995
+ ### Scale & Accuracy:
996
+ - **No absolute scale**: Models are in arbitrary units
997
+ - **Relative accuracy**: Spatial relationships preserved
998
+ - **To add scale**: Use known dimensions (door height, etc.)
999
+ - **For georeferencing**: Add ground control points in GIS
1000
 
1001
  ## Troubleshooting Urban Scenes
1002
 
 
1068
  - Evaluate flood vulnerability
1069
  - Design cooling corridors
1070
 
1071
+ ## Getting Started: Sample Project
1072
+
1073
+ **Neighborhood Documentation Project:**
1074
+
1075
+ 1. **Planning** (1 hour):
1076
+ - Define study area boundaries
1077
+ - Create photo waypoints
1078
+ - Identify key features
1079
+ - Prepare equipment
1080
+
1081
+ 2. **Field Work** (2-4 hours):
1082
+ - Walk planned route
1083
+ - Photograph key locations
1084
+ - Take notes on conditions
1085
+ - Document GPS coordinates
1086
+
1087
+ 3. **Processing** (1-2 hours):
1088
+ - Upload photos to tool
1089
+ - Generate 3D models
1090
+ - Download all outputs
1091
+ - Organize files
1092
+
1093
+ 4. **Analysis** (variable):
1094
+ - Import to GIS
1095
+ - Georeference models
1096
+ - Extract metrics
1097
+ - Create visualizations
1098
+
1099
+ 5. **Reporting** (1-2 hours):
1100
+ - Compile findings
1101
+ - Create maps and figures
1102
+ - Document methodology
1103
+ - Share with stakeholders
1104
+
1105
+ ## Educational Uses
1106
+
1107
+ **For Geography Students:**
1108
+ - Learn spatial analysis
1109
+ - Understand urban form
1110
+ - Practice GIS integration
1111
+ - Develop field skills
1112
+
1113
+ **For Planning Studios:**
1114
+ - Document existing conditions
1115
+ - Analyze site context
1116
+ - Test design proposals
1117
+ - Communicate ideas
1118
+
1119
+ **For Community Workshops:**
1120
+ - Engage residents
1121
+ - Document neighborhood character
1122
+ - Support advocacy
1123
+ - Build capacity
1124
  """)
1125
  gr.Markdown("""
1126
  ## How to Use This Application
 
1205
  - https://www.creators3d.com/online-viewer
1206
  - Just drag and drop your OBJ/PLY file
1207
 
1208
+ ### For 3D Printing:
1209
+ 1. Use the `mesh.stl` file
1210
+ 2. Check metrics: Look for "Watertight: βœ“"
1211
+ 3. Import into your slicer (Cura, PrusaSlicer, etc.)
1212
+ 4. Scale to desired size
1213
+ 5. Slice and print!
1214
 
1215
  ## Tips for Best Results
1216
 
 
1306
  """)
1307
 
1308
  # ========== CITATION TAB ==========
1309
+ with gr.Tab("πŸ“„ Citation & Credits"):
1310
  gr.Markdown("""
1311
+ ## How to Cite
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1312
 
1313
+ If you use this application in your research, please cite the relevant papers:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1314
 
1315
  ### For GLPN Model:
1316
  ```bibtex
 
1341
  - **Plotly**: Interactive 3D visualization
1342
  - **Gradio**: Web interface
1343
 
1344
+ ## License & Usage
1345
+
1346
+ - **Code**: MIT License
1347
+ - **Generated 3D Models**: You own the outputs
1348
+
1349
+ ## Contact & Support
1350
+
1351
+ For issues, questions, or suggestions, use the Community tab on Hugging Face.
1352
  """)
1353
 
1354
  # ========== FOOTER ==========
1355
  gr.Markdown("""
1356
  ---
1357
 
1358
+ ### πŸŽ“ PhD Application Demo
 
 
 
 
 
 
 
1359
 
1360
+ This application demonstrates comprehensive understanding of:
1361
+ - Computer vision and deep learning
1362
+ - 3D geometry and reconstruction
1363
+ - Software engineering best practices
1364
+ - Research methodology and evaluation
1365
 
1366
+ **Developed for academic research purposes**
1367
 
1368
+ *Version 1.0*
1369
  """)
1370
 
1371
  # ============================================================================