Transform global yaw to local yaw (alpha in kitti) in camera coordinates, ranges from -pi to pi. Args: yaw (Tensor): A vector with local yaw of each box in shape (N, ). loc (Tensor): Gravity center of each box in shape (N, 3). Returns: Tensor: Local yaw (alpha i
(yaw: Tensor, loc: Tensor)
| 432 | |
| 433 | |
| 434 | def yaw2local(yaw: Tensor, loc: Tensor) -> Tensor: |
| 435 | """Transform global yaw to local yaw (alpha in kitti) in camera |
| 436 | coordinates, ranges from -pi to pi. |
| 437 | |
| 438 | Args: |
| 439 | yaw (Tensor): A vector with local yaw of each box in shape (N, ). |
| 440 | loc (Tensor): Gravity center of each box in shape (N, 3). |
| 441 | |
| 442 | Returns: |
| 443 | Tensor: Local yaw (alpha in kitti). |
| 444 | """ |
| 445 | local_yaw = yaw - torch.atan2(loc[:, 0], loc[:, 2]) |
| 446 | larger_idx = (local_yaw > np.pi).nonzero(as_tuple=False) |
| 447 | small_idx = (local_yaw < -np.pi).nonzero(as_tuple=False) |
| 448 | if len(larger_idx) != 0: |
| 449 | local_yaw[larger_idx] -= 2 * np.pi |
| 450 | if len(small_idx) != 0: |
| 451 | local_yaw[small_idx] += 2 * np.pi |
| 452 | |
| 453 | return local_yaw |
| 454 | |
| 455 | |
| 456 | def get_lidar2img(cam2img: Tensor, lidar2cam: Tensor) -> Tensor: |
nothing calls this directly
no outgoing calls
no test coverage detected