Points of instances in DEPTH coordinates. Args: tensor (Tensor or np.ndarray or Sequence[Sequence[float]]): The points data with shape (N, points_dim). points_dim (int): Integer indicating the dimension of a point. Each row is (x, y, z, ...). Defaults to
| 8 | |
| 9 | |
| 10 | class DepthPoints(BasePoints): |
| 11 | """Points of instances in DEPTH coordinates. |
| 12 | |
| 13 | Args: |
| 14 | tensor (Tensor or np.ndarray or Sequence[Sequence[float]]): The points |
| 15 | data with shape (N, points_dim). |
| 16 | points_dim (int): Integer indicating the dimension of a point. Each row |
| 17 | is (x, y, z, ...). Defaults to 3. |
| 18 | attribute_dims (dict, optional): Dictionary to indicate the meaning of |
| 19 | extra dimension. Defaults to None. |
| 20 | |
| 21 | Attributes: |
| 22 | tensor (Tensor): Float matrix with shape (N, points_dim). |
| 23 | points_dim (int): Integer indicating the dimension of a point. Each row |
| 24 | is (x, y, z, ...). |
| 25 | attribute_dims (dict, optional): Dictionary to indicate the meaning of |
| 26 | extra dimension. Defaults to None. |
| 27 | rotation_axis (int): Default rotation axis for points rotation. |
| 28 | """ |
| 29 | |
| 30 | def __init__(self, |
| 31 | tensor: Union[Tensor, np.ndarray, Sequence[Sequence[float]]], |
| 32 | points_dim: int = 3, |
| 33 | attribute_dims: Optional[dict] = None) -> None: |
| 34 | super(DepthPoints, self).__init__(tensor, |
| 35 | points_dim=points_dim, |
| 36 | attribute_dims=attribute_dims) |
| 37 | self.rotation_axis = 2 |
| 38 | |
| 39 | def flip(self, bev_direction: str = 'horizontal') -> None: |
| 40 | """Flip the points along given BEV direction. |
| 41 | |
| 42 | Args: |
| 43 | bev_direction (str): Flip direction (horizontal or vertical). |
| 44 | Defaults to 'horizontal'. |
| 45 | """ |
| 46 | assert bev_direction in ('horizontal', 'vertical') |
| 47 | if bev_direction == 'horizontal': |
| 48 | self.tensor[:, 0] = -self.tensor[:, 0] |
| 49 | elif bev_direction == 'vertical': |
| 50 | self.tensor[:, 1] = -self.tensor[:, 1] |
| 51 | |
| 52 | def convert_to(self, |
| 53 | dst: int, |
| 54 | rt_mat: Optional[Union[Tensor, |
| 55 | np.ndarray]] = None) -> 'BasePoints': |
| 56 | """Convert self to ``dst`` mode. |
| 57 | |
| 58 | Args: |
| 59 | dst (int): The target Point mode. |
| 60 | rt_mat (Tensor or np.ndarray, optional): The rotation and |
| 61 | translation matrix between different coordinates. |
| 62 | Defaults to None. The conversion from ``src`` coordinates to |
| 63 | ``dst`` coordinates usually comes along the change of sensors, |
| 64 | e.g., from camera to LiDAR. This requires a transformation |
| 65 | matrix. |
| 66 | |
| 67 | Returns: |
nothing calls this directly
no outgoing calls
no test coverage detected