def r2n2_depth_images(self): if not hasattr(self, '_r2n2_depth_images'): if self.depth_native_res == 137: self._r2n2_depth_images = gaps_util.read_depth_directory( self.r2n2_depth_dir, 24) elif self.depth_native_res == 224: self._r2n2_depth_images, self._r2n2_normal_world_images = ( self.load_depth_and_normal_npz(self.r2n2_depth_dir + '.npz')) return self._r2n2_depth_images
def write_depth_and_normals_npz(dirpath, path_out): depth_images = gaps_util.read_depth_directory(f'{dirpath}/depth_images', 20) normal_images = gaps_util.read_normals_dir(f'{dirpath}/normals', 20) depth_images = depth_images[..., np.newaxis] arr = np.concatenate([depth_images, normal_images], axis=-1) np.savez_compressed(path_out, arr) # Delete the images, they are no longer needed: remove_png_dir(f'{dirpath}/depth_images') remove_png_dir(f'{dirpath}/normals')
def write_depth_and_normals_npz(dirpath, path_out): depth_images = gaps_util.read_depth_directory(f'{dirpath}/depth_images', 20) normal_images = gaps_util.read_normals_dir(f'{dirpath}/normals', 20) depth_images = depth_images[..., np.newaxis] arr = np.concatenate([depth_images, normal_images], axis=-1) np.savez_compressed(path_out, arr)