mcnabbd commited on
Commit
cec9315
·
verified ·
1 Parent(s): 8786cee

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

Browse files

I hope I've done this right. I also see a min_depth. perhaps it isn't a commonly used feature. We might want to include it too.

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