From 1375c159f9f78e8412c5df6421483d13eb065653 Mon Sep 17 00:00:00 2001 From: Igor Maurell Date: Wed, 13 Nov 2024 20:27:37 -0300 Subject: [PATCH] :bug: Fix: handling an edge case that makes the object position to be on the camera sometimes. --- .../butia_image2world/image2world/image2world.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/butia_image2world/scripts/butia_image2world/image2world/image2world.py b/butia_image2world/scripts/butia_image2world/image2world/image2world.py index 911edf8..7313d6f 100755 --- a/butia_image2world/scripts/butia_image2world/image2world/image2world.py +++ b/butia_image2world/scripts/butia_image2world/image2world/image2world.py @@ -224,6 +224,7 @@ def __detectionDescriptionProcessing(self, data, description2d, header): if center_depth <= 0: rospy.logwarn('INVALID DEPTH VALUE') + return None center_depth/= 1000. @@ -311,7 +312,9 @@ def __instanceSegmentationDescriptionProcessing(self, source_data, description2d return None def __poseDescriptionProcessing(self, data, description2d : Description2D, header): - description3d : Description3D = self.__detectionDescriptionProcessing(data, description2d ,header) + description3d = self.__detectionDescriptionProcessing(data, description2d ,header) + if description3d is None: + return None if 'image_depth' in data and 'camera_info' in data: image_depth = data['image_depth'] @@ -357,9 +360,10 @@ def __poseDescriptionProcessing(self, data, description2d : Description2D, heade def __createDescription3D(self, source_data, description2d : Description2D, header): if description2d.type in self.DESCRIPTION_PROCESSING_ALGORITHMS: - description3D : Description3D = self.DESCRIPTION_PROCESSING_ALGORITHMS[description2d.type](source_data, description2d, header) - description3D.bbox2D = description2d.bbox - description3D.class_num = description2d.class_num + description3D = self.DESCRIPTION_PROCESSING_ALGORITHMS[description2d.type](source_data, description2d, header) + if description3D is not None: + description3D.bbox2D = description2d.bbox + description3D.class_num = description2d.class_num return description3D else: return None