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

Function plot_flow

Utility/Plot/PlotAxes.py:79–91  ·  view source on GitHub ↗

Expect Shape and range: flow - (2, H, W) - Any range

(ax: Axes, flow: torch.Tensor | None | np.ndarray)

Source from the content-addressed store, hash-verified

77@as_chain_func
78@IgnoreException
79def plot_flow(ax: Axes, flow: torch.Tensor | None | np.ndarray) -> Axes:
80 """
81 Expect Shape and range:
82 flow - (2, H, W) - Any range
83 """
84 if flow is None: return ax
85
86 assert flow.shape[0] == 2 # 2 x H x W
87 if isinstance(flow, torch.Tensor):
88 color_map = flow_to_color(flow.permute(1, 2, 0).numpy())
89 else:
90 color_map = flow_to_color(flow.transpose((1, 2, 0)))
91 return plot_image(color_map)(ax)
92
93@as_chain_func
94@IgnoreException

Callers

nothing calls this directly

Calls 1

plot_imageFunction · 0.85

Tested by

no test coverage detected