From 009aecd561273745413b6624ddd969fbb4537152 Mon Sep 17 00:00:00 2001 From: Christoph Sager Date: Sun, 18 Aug 2024 18:59:52 +0200 Subject: [PATCH] Use height to calculate kitti centroid (#167) Closes: #163 --- labelCloud/io/labels/kitti.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/labelCloud/io/labels/kitti.py b/labelCloud/io/labels/kitti.py index 29584f9..056fee0 100644 --- a/labelCloud/io/labels/kitti.py +++ b/labelCloud/io/labels/kitti.py @@ -144,15 +144,15 @@ 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 @@ -160,7 +160,7 @@ def export_labels(self, bboxes: List[BBox], pcd_path: Path) -> None: 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