MCPcopy Create free account
hub / github.com/DIVE128/DMVSNet / visualization

Method visualization

model.py:393–410  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

391
392 @torch.no_grad()
393 def visualization(self):
394
395 import matplotlib as mpl
396 import matplotlib.cm as cm
397 from PIL import Image
398
399 save_dir = self.args.depth_img_save_dir
400 depth_path = self.args.depth_path
401
402 depth, scale = read_pfm(depth_path)
403 vmax = np.percentile(depth, 95)
404 normalizer = mpl.colors.Normalize(vmin=depth.min(), vmax=vmax)
405 mapper = cm.ScalarMappable(norm=normalizer, cmap='magma')
406 colormapped_im = (mapper.to_rgba(depth)[:, :, :3] * 255).astype(np.uint8)
407 im = Image.fromarray(colormapped_im)
408 im.save(os.path.join(save_dir, "depth.png"))
409
410 print("Successfully visualize!")
411

Callers 1

mainMethod · 0.95

Calls 2

read_pfmFunction · 0.90
printFunction · 0.85

Tested by

no test coverage detected