Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
81d4d32
1
Parent(s):
45a142d
add example
Browse files
app.py
CHANGED
|
@@ -271,6 +271,14 @@ def get_model(model_size):
|
|
| 271 |
raise ValueError(f"Unsupported model size: {model_size}")
|
| 272 |
|
| 273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
@spaces.GPU
|
| 275 |
def process_video(
|
| 276 |
video_file,
|
|
@@ -416,6 +424,13 @@ def process_video(
|
|
| 416 |
#* save pcd: o3d.io.write_point_cloud(f'{pc_save_dir}/{timestamp}_{idx:02d}.ply', pcd)
|
| 417 |
points = np.asarray(pcd.points)
|
| 418 |
colors = np.asarray(pcd.colors) if pcd.has_colors() else None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
glb_filename = os.path.join(pc_save_dir, f'{timestamp}_{idx:02d}.glb')
|
| 420 |
success = create_simple_glb_from_pointcloud(points, colors, glb_filename)
|
| 421 |
if not success:
|
|
@@ -617,8 +632,6 @@ with gr.Blocks(css=css, title="DKT", head=head_html) as demo:
|
|
| 617 |
label="Point Cloud Key Frame 1",
|
| 618 |
clear_color=[1.0, 1.0, 1.0, 1.0],
|
| 619 |
interactive=False,
|
| 620 |
-
# height=400,
|
| 621 |
-
|
| 622 |
)
|
| 623 |
with gr.Column(scale=1):
|
| 624 |
output_point_map1 = gr.Model3D(
|
|
|
|
| 271 |
raise ValueError(f"Unsupported model size: {model_size}")
|
| 272 |
|
| 273 |
|
| 274 |
+
def flip_points(points):
|
| 275 |
+
flipped = points.copy()
|
| 276 |
+
flipped[:, 2] = -flipped[:, 2] # 上下翻转点云
|
| 277 |
+
return flipped
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
|
| 282 |
@spaces.GPU
|
| 283 |
def process_video(
|
| 284 |
video_file,
|
|
|
|
| 424 |
#* save pcd: o3d.io.write_point_cloud(f'{pc_save_dir}/{timestamp}_{idx:02d}.ply', pcd)
|
| 425 |
points = np.asarray(pcd.points)
|
| 426 |
colors = np.asarray(pcd.colors) if pcd.has_colors() else None
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
# ==== 新增:上下翻转点云 ====
|
| 430 |
+
points = flip_points(points)
|
| 431 |
+
# =========================
|
| 432 |
+
|
| 433 |
+
|
| 434 |
glb_filename = os.path.join(pc_save_dir, f'{timestamp}_{idx:02d}.glb')
|
| 435 |
success = create_simple_glb_from_pointcloud(points, colors, glb_filename)
|
| 436 |
if not success:
|
|
|
|
| 632 |
label="Point Cloud Key Frame 1",
|
| 633 |
clear_color=[1.0, 1.0, 1.0, 1.0],
|
| 634 |
interactive=False,
|
|
|
|
|
|
|
| 635 |
)
|
| 636 |
with gr.Column(scale=1):
|
| 637 |
output_point_map1 = gr.Model3D(
|