Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -229,7 +229,7 @@ def rgb2gray(rgb):
|
|
229 |
return np.dot(rgb[...,:3], [0.333, 0.333, 0.333])
|
230 |
|
231 |
def get_mesh(image, depth, fnum):
|
232 |
-
gdepth = rgb2gray(depth[fnum])
|
233 |
print('depth to gray - ok')
|
234 |
points = pano_depth_to_world_points(gdepth, 1)
|
235 |
pts3d = points[0]
|
@@ -243,7 +243,7 @@ def get_mesh(image, depth, fnum):
|
|
243 |
verts = pts3d.reshape(-1, 3)
|
244 |
#triangles = create_triangles(image.shape[0], image.shape[1])
|
245 |
#print('triangles - ok')
|
246 |
-
rgba = cv2.cvtColor(image[fnum], cv2.COLOR_RGB2RGBA)
|
247 |
colors = rgba.reshape(-1, 4)
|
248 |
clrs = [[128, 128, 128, 0]]
|
249 |
|
@@ -317,8 +317,8 @@ with gr.Blocks(css=css) as demo:
|
|
317 |
input_video = gr.Video(label="Input Video", format="mp4")
|
318 |
input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
|
319 |
submit = gr.Button("Submit")
|
320 |
-
output_frame = gr.Gallery(label="Frame", type='numpy',
|
321 |
-
output_depth = gr.Gallery(label="Depth", type='numpy',
|
322 |
frame_n = gr.Slider(label="Frame #", minimum=0, maximum=0, step=1, value=0)
|
323 |
render = gr.Button("Render")
|
324 |
with gr.Column():
|
|
|
229 |
return np.dot(rgb[...,:3], [0.333, 0.333, 0.333])
|
230 |
|
231 |
def get_mesh(image, depth, fnum):
|
232 |
+
gdepth = rgb2gray(depth[fnum][0])
|
233 |
print('depth to gray - ok')
|
234 |
points = pano_depth_to_world_points(gdepth, 1)
|
235 |
pts3d = points[0]
|
|
|
243 |
verts = pts3d.reshape(-1, 3)
|
244 |
#triangles = create_triangles(image.shape[0], image.shape[1])
|
245 |
#print('triangles - ok')
|
246 |
+
rgba = cv2.cvtColor(image[fnum][0], cv2.COLOR_RGB2RGBA)
|
247 |
colors = rgba.reshape(-1, 4)
|
248 |
clrs = [[128, 128, 128, 0]]
|
249 |
|
|
|
317 |
input_video = gr.Video(label="Input Video", format="mp4")
|
318 |
input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
|
319 |
submit = gr.Button("Submit")
|
320 |
+
output_frame = gr.Gallery(label="Frame", type='numpy', columns=8192)
|
321 |
+
output_depth = gr.Gallery(label="Depth", type='numpy', columns=8192)
|
322 |
frame_n = gr.Slider(label="Frame #", minimum=0, maximum=0, step=1, value=0)
|
323 |
render = gr.Button("Render")
|
324 |
with gr.Column():
|