Skip to content

Commit

Permalink
Use height to calculate kitti centroid
Browse files Browse the repository at this point in the history
Closes: #163
  • Loading branch information
ch-sa committed Aug 18, 2024
1 parent dcfe94f commit 75267c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions labelCloud/io/labels/kitti.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,23 @@ def export_labels(self, bboxes: List[BBox], pcd_path: Path) -> None:
for bbox in bboxes:
obj_type = bbox.get_classname()
centroid = bbox.get_center()
dimensions = bbox.get_dimensions()
length, width, height = bbox.get_dimensions()

# invert sequence to height, width, length
dimensions = dimensions[2], dimensions[1], dimensions[0]
dimensions = height, width, length

if self.transformed:
try:
self._get_transforms(pcd_path)
except CalibrationFileNotFound as exc:
except CalibrationFileNotFound:
logging.exception("Calibration file not found")
logging.warning("Skipping writing of labels for this point cloud")
return

centroid = (
centroid[0],
centroid[1],
centroid[2] - dimensions[2] / 2,
centroid[2] - height / 2,
) # centroid in KITTI located on bottom face of bbox
xyz1 = np.insert(np.asarray(centroid), 3, values=[1])
xyz1 = self.T_v2c @ xyz1
Expand Down

0 comments on commit 75267c5

Please sign in to comment.