MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / colorize_error_map

Function colorize_error_map

eval_code/recons/models/moge/utils/vis.py:58–65  ·  view source on GitHub ↗
(error_map: np.ndarray, mask: np.ndarray = None, cmap: str = 'plasma', value_range: Tuple[float, float] = None)

Source from the content-addressed store, hash-verified

56
57
58def colorize_error_map(error_map: np.ndarray, mask: np.ndarray = None, cmap: str = 'plasma', value_range: Tuple[float, float] = None):
59 vmin, vmax = value_range if value_range is not None else (np.nanmin(error_map), np.nanmax(error_map))
60 cmap = matplotlib.colormaps[cmap]
61 colorized_error_map = cmap(((error_map - vmin) / (vmax - vmin)).clip(0, 1))[..., :3]
62 if mask is not None:
63 colorized_error_map = np.where(mask[..., None], colorized_error_map, 0)
64 colorized_error_map = np.ascontiguousarray((colorized_error_map.clip(0, 1) * 255).astype(np.uint8))
65 return colorized_error_map

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected