MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / plot_mask

Function plot_mask

Utility/Plot/PlotAxes.py:95–105  ·  view source on GitHub ↗
(ax: Axes, mask: torch.Tensor | np.ndarray | None)

Source from the content-addressed store, hash-verified

93@as_chain_func
94@IgnoreException
95def plot_mask(ax: Axes, mask: torch.Tensor | np.ndarray | None) -> Axes:
96 if mask is None: return ax
97 if isinstance(mask, torch.Tensor):
98 mask = mask.float().detach().cpu().numpy()
99
100 H, W = mask.shape
101 rgba_mask = np.zeros((H, W, 4))
102 rgba_mask[..., 0:3] = 1
103 rgba_mask[..., 3] = 1 - mask # Alpha channel (0 = transparent, 1 = opaque)
104 ax.imshow(rgba_mask)
105 return ax
106
107@as_chain_func
108@IgnoreException

Callers 1

plot_whiten_imageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected