def vis(self): image = self["image"] depth_vis = self["_raw_exr"].get_pseudo_color() inst_vis = greyToRgb(histEqualize(self["inst"])) vis = ( np.concatenate([inst_vis, image[..., :3] / 255.0, depth_vis], 1) * 255).astype(np.uint8) return vis
def test_heatmap_to_pseudo_color(depth): def _f(v): return tuple(interpolate_or_clip(turbo_colormap_data, v)) vf = np.vectorize(_f) with timeit("vf"): color1 = np.concatenate([i[..., None] for i in vf(depth)], -1) with timeit("heatmap_to_pseudo_color"): color2 = heatmap_to_pseudo_color(depth) mg() assert (np.abs(color1 - color2) < 1 / 256).all() show - color1
def vis(self): vis_list = [] # RGB float 0.~1. def vis_inst(inst): unique, _idxs = np.unique(inst, return_inverse=True) idxs = _idxs.reshape(inst.shape) return boxx.mapping_array( idxs, boxx.getDefaultColorList(len(unique), includeBackGround=True)) if "inst" in self: inst_vis = vis_inst(self["inst"]) vis_list.append(inst_vis) if self.get("image") is not None: image = self["image"] vis_list.append(image[..., :3] / 255.0) depth_vis = self["_raw_exr"].get_pseudo_color() vis_list.append(depth_vis) vis = (np.concatenate(vis_list, 1) * 255).astype(np.uint8) return vis
def get_rgba(self): return np.concatenate([self.get_rgb(), self["A"][..., None]], -1)
def get_rgb(self): return np.concatenate( [self["R"][..., None], self["G"][..., None], self["B"][..., None]], -1)