mcnabbd commited on
Commit
0be6564
1 Parent(s): 276bb3c

Scale raw depth by 65535 to use full 16-bit dynamic range

Browse files
Files changed (1) hide show
  1. 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:256")
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*256).astype('uint16'))
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