(self, frame: StereoData, numPoint: int, depth0_est: IStereoDepth.Output, depth1_est: IStereoDepth.Output, match_est: IMatcher.Output | None)
| 85 | }) |
| 86 | |
| 87 | def select_point(self, frame: StereoData, numPoint: int, depth0_est: IStereoDepth.Output, depth1_est: IStereoDepth.Output, match_est: IMatcher.Output | None) -> torch.Tensor: |
| 88 | assert depth0_est.cov is not None |
| 89 | depth_mask = depth0_est.depth < self.config.max_depth |
| 90 | depth_cov_mask = depth0_est.cov < self.config.max_depth_cov |
| 91 | border_mask = torch.zeros_like(depth_mask, dtype=torch.bool) |
| 92 | border_mask[ |
| 93 | ..., self.config.mask_width : -self.config.mask_width, self.config.mask_width : -self.config.mask_width |
| 94 | ] = True |
| 95 | |
| 96 | candidates = depth_mask & depth_cov_mask & border_mask |
| 97 | selected_points = torch.nonzero(candidates, as_tuple=False) |
| 98 | perm = torch.randperm(selected_points.size(0))[:numPoint] |
| 99 | pixels = selected_points[perm][..., 2:].roll(shifts=1, dims=1) |
| 100 | return pixels |
| 101 | |
| 102 | |
| 103 | class RandomSelector(IKeypointSelector): |
nothing calls this directly
no outgoing calls
no test coverage detected