(obs: MatchObs, depth: IStereoDepth.Output, match: IMatcher.Output, frame0: StereoFrame, frame1: StereoFrame)
| 282 | @register |
| 283 | @staticmethod |
| 284 | def plot_macvo(obs: MatchObs, depth: IStereoDepth.Output, match: IMatcher.Output, frame0: StereoFrame, frame1: StereoFrame) -> Figure: |
| 285 | if match.cov is not None: |
| 286 | flow_det = (match.cov[:, 0] * match.cov[:, 1] - match.cov[:, 2].square())[0] |
| 287 | else: |
| 288 | flow_det = None |
| 289 | |
| 290 | plot_args = [ |
| 291 | # Plot left camera at frame 0 |
| 292 | Plot.plot_image(frame0.stereo.imageL[0].permute(1, 2, 0)) |
| 293 | >> Plot.plot_no_border() |
| 294 | >> Chain.side_effect(lambda ax: ax.set_title(f"Frame {frame0.frame_idx} Left", loc="left")), |
| 295 | |
| 296 | # Plot left camera at frame 1, with keypoints overlayed on it |
| 297 | Plot.plot_whiten_image(frame1.stereo.imageL[0].permute(1, 2, 0), whiten=0.75) |
| 298 | >> Plot.plot_no_border() |
| 299 | >> Plot.plot_flow_cov(obs.data["pixel2_uv"], obs.data["pixel2_uv_cov"]) |
| 300 | >> Plot.plot_keypoints(obs.data["pixel2_uv"], obs.data["pixel2_d_cov"], s=2, marker='.') |
| 301 | >> Chain.side_effect(lambda ax: ax.set_title(f"Frame {frame1.frame_idx} Left", loc="left")), |
| 302 | |
| 303 | # Plot depth cov estimation |
| 304 | Plot.plot_scalarmap(None if depth.cov is None else depth.cov.sqrt().detach().cpu()[0, 0], colorbar=True) |
| 305 | >> Plot.plot_mask(None if depth.mask is None else depth.mask[0, 0].detach().cpu()) |
| 306 | >> Plot.plot_no_border() |
| 307 | >> Chain.side_effect(lambda ax: ax.set_title(f"Depth Cov (sqrt, Pred Mask)", loc="left")), |
| 308 | |
| 309 | # Plot flow cov estimation |
| 310 | Plot.plot_scalarmap(None if flow_det is None else flow_det.log10().detach().cpu(), colorbar=True) |
| 311 | >> Plot.plot_no_border() |
| 312 | >> Chain.side_effect(lambda ax: ax.set_title("Pred cov_det (log)", loc="left")), |
| 313 | ] |
| 314 | return Matplotlib_Visualizer.__plot_grid(dpi=Matplotlib_Visualizer.default_dpi, n_rows=2, n_cols=2, plot_args=plot_args) |
| 315 | |
| 316 | @register |
| 317 | @staticmethod |
no test coverage detected