Expect Shape and range: flow - (2, H, W) - Any range
(ax: Axes, flow: torch.Tensor | None | np.ndarray)
| 77 | @as_chain_func |
| 78 | @IgnoreException |
| 79 | def 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 |
nothing calls this directly
no test coverage detected