(filename, depth, depth_min, depth_max)
| 339 | |
| 340 | |
| 341 | def write_depth_img(filename, depth, depth_min, depth_max): |
| 342 | |
| 343 | if not os.path.exists(os.path.dirname(filename)): |
| 344 | # try: |
| 345 | os.makedirs(os.path.dirname(filename)) |
| 346 | # except OSError as exc: # Guard against race condition |
| 347 | # if exc.errno != errno.EEXIST: |
| 348 | # raise |
| 349 | |
| 350 | image = Image.fromarray((depth - depth_min) / (depth_max - depth_min) * 255).convert("L") |
| 351 | image.save(filename) |
| 352 | return 1 |
| 353 | |
| 354 | |
| 355 | # project the reference point cloud into the source view, then project back |