andrefdre / Dora_the_mug_finder_SAVI

Dora The Mug Finder: Detection and classification of items placed on top of a table using point cloud processing and neural networks.
GNU General Public License v3.0
5 stars 1 forks source link

Find properties for all objects #19

Closed TatianaResend closed 1 year ago

TatianaResend commented 1 year ago

Change from finding one object's properties to everyone in the scene.

TatianaResend commented 1 year ago

For the properties height, width and length it was successfully performed. #4

TatianaResend commented 1 year ago

As the objects are being selected all at once (through a for loop), the properties are also calculated for all objects.

for object_idx in object_idxs:
      object_point_idxs = list(locate(cluster_idxs, lambda x: x == object_idx))
      object_points = point_cloud_objects_noise.select_by_index(object_point_idxs)

      #Create a dictionary to define the objects
      d = {}
      d['idx'] = str(object_idx)
      d['points'] = object_points
      d['bbox_obj'] = d['points'].get_axis_aligned_bounding_box()

      #Properties of objects (length, width, height)
      bbox_max = d['points'].get_max_bound()
      bbox_min = d['points'].get_min_bound()
      d['length'] = abs(abs(bbox_max[0])-abs(bbox_min[0])) #axis x
      d['width'] = abs(abs(bbox_max[1])-abs(bbox_min[1])) #axis y
      d['height'] = abs(abs(bbox_max[2])-abs(bbox_min[2])) #axis z
      objects.append(d) #Add the dict of this object to the list