Spaces:
Running
on
Zero
Running
on
Zero
log every 10 frames
Browse files
app.py
CHANGED
@@ -57,10 +57,11 @@ def run_rerun(path_to_video):
|
|
57 |
|
58 |
print("Loading video from", path_to_video)
|
59 |
video = cv2.VideoCapture(path_to_video)
|
60 |
-
frame_idx =
|
61 |
while True:
|
62 |
read, frame = video.read()
|
63 |
-
|
|
|
64 |
break
|
65 |
|
66 |
frame = cv2.resize(frame, (320, 240))
|
@@ -68,6 +69,7 @@ def run_rerun(path_to_video):
|
|
68 |
|
69 |
rr.set_time_sequence("frame", frame_idx)
|
70 |
rr.log("world/camera/image", rr.Image(frame))
|
|
|
71 |
yield stream.read()
|
72 |
|
73 |
depth, focal_length = estimate_depth(frame)
|
@@ -105,17 +107,12 @@ def estimate_depth(frame):
|
|
105 |
|
106 |
|
107 |
with gr.Blocks() as demo:
|
108 |
-
video = gr.Video(interactive=True, label="Video")
|
109 |
visualize = gr.Button("Visualize ML Depth Pro")
|
110 |
|
111 |
with gr.Row():
|
112 |
viewer = Rerun(
|
113 |
streaming=True,
|
114 |
-
panel_states={
|
115 |
-
"time": "collapsed",
|
116 |
-
"blueprint": "hidden",
|
117 |
-
"selection": "hidden",
|
118 |
-
},
|
119 |
)
|
120 |
visualize.click(run_rerun, inputs=[video], outputs=[viewer])
|
121 |
|
|
|
57 |
|
58 |
print("Loading video from", path_to_video)
|
59 |
video = cv2.VideoCapture(path_to_video)
|
60 |
+
frame_idx = -1
|
61 |
while True:
|
62 |
read, frame = video.read()
|
63 |
+
frame_idx += 1
|
64 |
+
if not read or frame_idx % 10 != 0:
|
65 |
break
|
66 |
|
67 |
frame = cv2.resize(frame, (320, 240))
|
|
|
69 |
|
70 |
rr.set_time_sequence("frame", frame_idx)
|
71 |
rr.log("world/camera/image", rr.Image(frame))
|
72 |
+
|
73 |
yield stream.read()
|
74 |
|
75 |
depth, focal_length = estimate_depth(frame)
|
|
|
107 |
|
108 |
|
109 |
with gr.Blocks() as demo:
|
110 |
+
video = gr.Video(interactive=True, include_audio=False, label="Video")
|
111 |
visualize = gr.Button("Visualize ML Depth Pro")
|
112 |
|
113 |
with gr.Row():
|
114 |
viewer = Rerun(
|
115 |
streaming=True,
|
|
|
|
|
|
|
|
|
|
|
116 |
)
|
117 |
visualize.click(run_rerun, inputs=[video], outputs=[viewer])
|
118 |
|