Scale depth by 65535/max_depth for writing to 16-bit png

#6
by mcnabbd - opened
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -202,7 +202,7 @@ with gr.Blocks(css=css) as demo:
202
  pf_prediction_colored = colorize_depth(pf_prediction, cmap=color_map)
203
  coarse_predictioncolored = colorize_depth(coarse_prediction, cmap=color_map)
204
 
205
- raw_depth = Image.fromarray((pf_prediction*256).astype('uint16'))
206
  tmp = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
207
  raw_depth.save(tmp.name)
208
 
 
202
  pf_prediction_colored = colorize_depth(pf_prediction, cmap=color_map)
203
  coarse_predictioncolored = colorize_depth(coarse_prediction, cmap=color_map)
204
 
205
+ raw_depth = Image.fromarray((pf_prediction*(65535.0 / max_depth)).astype('uint16'))
206
  tmp = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
207
  raw_depth.save(tmp.name)
208