Spaces:
Running
on
A10G
Running
on
A10G
Scale raw depth by 65535 to use full 16-bit dynamic range
#10
by
mcnabbd
- opened
- gradio_depth_pred.py +2 -2
gradio_depth_pred.py
CHANGED
@@ -12,14 +12,14 @@ def create_demo(model):
|
|
12 |
with gr.Row():
|
13 |
input_image = gr.Image(label="Input Image", type='pil', elem_id='img-display-input').style(height="auto")
|
14 |
depth_image = gr.Image(label="Depth Map", elem_id='img-display-output')
|
15 |
-
raw_file = gr.File(label="16-bit raw depth, multiplier:
|
16 |
submit = gr.Button("Submit")
|
17 |
|
18 |
def on_submit(image):
|
19 |
depth = predict_depth(model, image)
|
20 |
colored_depth = colorize(depth, cmap='gray_r')
|
21 |
tmp = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
22 |
-
raw_depth = Image.fromarray((depth*
|
23 |
raw_depth.save(tmp.name)
|
24 |
return [colored_depth, tmp.name]
|
25 |
|
|
|
12 |
with gr.Row():
|
13 |
input_image = gr.Image(label="Input Image", type='pil', elem_id='img-display-input').style(height="auto")
|
14 |
depth_image = gr.Image(label="Depth Map", elem_id='img-display-output')
|
15 |
+
raw_file = gr.File(label="16-bit raw depth, multiplier:65535")
|
16 |
submit = gr.Button("Submit")
|
17 |
|
18 |
def on_submit(image):
|
19 |
depth = predict_depth(model, image)
|
20 |
colored_depth = colorize(depth, cmap='gray_r')
|
21 |
tmp = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
22 |
+
raw_depth = Image.fromarray((depth*65535).astype('uint16'))
|
23 |
raw_depth.save(tmp.name)
|
24 |
return [colored_depth, tmp.name]
|
25 |
|