Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,6 @@ from typing import List, Optional, Tuple
|
|
| 16 |
import cv2
|
| 17 |
import gradio as gr
|
| 18 |
import numpy as np
|
| 19 |
-
import open3d as o3d
|
| 20 |
import torch
|
| 21 |
import torchvision.transforms as T
|
| 22 |
import trimesh
|
|
@@ -102,11 +101,12 @@ def load_model(checkpoint_path: str = "checkpoints"):
|
|
| 102 |
def save_obj(vertices: np.ndarray, faces: np.ndarray, colors: np.ndarray, filepath: str):
|
| 103 |
vertices = vertices @ np.array([[1, 0, 0], [0, 1, 0], [0, 0, -1]])
|
| 104 |
faces = faces[:, [2, 1, 0]]
|
| 105 |
-
mesh =
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
| 110 |
|
| 111 |
|
| 112 |
def position_to_c2w(position: Tuple[float, float, float]) -> torch.Tensor:
|
|
@@ -495,7 +495,7 @@ def build_demo():
|
|
| 495 |
Upload a satellite image to **generate a 3D mesh** or **render a walkthrough video**.
|
| 496 |
|
| 497 |
📌 **Input requirements:** The satellite image should be at **zoom level 20**
|
| 498 |
-
(same as the [VIGOR](https://github.com/Jeff-Zilence/VIGOR) dataset), resized to
|
| 499 |
You can download satellite tiles at this zoom level from any map tile API (e.g. Google Maps, Bing Maps, Mapbox).
|
| 500 |
"""
|
| 501 |
)
|
|
|
|
| 16 |
import cv2
|
| 17 |
import gradio as gr
|
| 18 |
import numpy as np
|
|
|
|
| 19 |
import torch
|
| 20 |
import torchvision.transforms as T
|
| 21 |
import trimesh
|
|
|
|
| 101 |
def save_obj(vertices: np.ndarray, faces: np.ndarray, colors: np.ndarray, filepath: str):
|
| 102 |
vertices = vertices @ np.array([[1, 0, 0], [0, 1, 0], [0, 0, -1]])
|
| 103 |
faces = faces[:, [2, 1, 0]]
|
| 104 |
+
mesh = trimesh.Trimesh(
|
| 105 |
+
vertices=vertices,
|
| 106 |
+
faces=faces,
|
| 107 |
+
vertex_colors=colors.astype(np.uint8),
|
| 108 |
+
)
|
| 109 |
+
mesh.export(filepath)
|
| 110 |
|
| 111 |
|
| 112 |
def position_to_c2w(position: Tuple[float, float, float]) -> torch.Tensor:
|
|
|
|
| 495 |
Upload a satellite image to **generate a 3D mesh** or **render a walkthrough video**.
|
| 496 |
|
| 497 |
📌 **Input requirements:** The satellite image should be at **zoom level 20**
|
| 498 |
+
(same as the [VIGOR](https://github.com/Jeff-Zilence/VIGOR) dataset), then will be resized to the input size.
|
| 499 |
You can download satellite tiles at this zoom level from any map tile API (e.g. Google Maps, Bing Maps, Mapbox).
|
| 500 |
"""
|
| 501 |
)
|