0

I'm working with python on a 3d point cloud files that are in format XYZ, I need to calculate the distance from each one of them to the center, and then label (and colour for better visualization) them according to it. So far I got this cloud classification using this code:

xyz_coordinates = points[:, 0:3]
xyz_min = np.amin(xyz_coordinates, axis=0) # 3, gets minimum of each axis
xyz_max = np.amax(xyz_coordinates, axis=0) # 3, gets maximum of each axis
xyz_center = (xyz_min + xyz_max) / 2
xyz_max_euclidean=distance.euclidean(xyz_center,xyz_max) # gets euclidean distance, it gives me circles
xyz_cut=xyz_max_euclidean/N_CLASSES

# gets the euclidean distance for all points and assign normalized tagged classes  
for i in xrange(xyz_coordinates.shape[0]):
    label=int(math.floor(distance.euclidean(xyz_center,xyz_coordinates[i])/xyz_cut))
    point_bbox_list.append(np.concatenate([xyz_coordinates[i],g_distance2color[str(label)],np.array([label])],0)) 

but as you can see I am calculating the euclidean distance from the center to each one of the points, and this is not correct, in this case, for example the limit of the walls or the table are not correct. I imagined this kind of graph but with a squared coloured shape. Right now I been successful in calculating the bounding boxes for each object, shown here but I can not get the results I expect. I've tried also with mahalanobis distance, but the classification turns out as an ellipsoid, is there any other calculating distance metric that I can use?

mx0
  • 6,445
  • 12
  • 49
  • 54
raizend1
  • 1
  • 1
  • I'm not sure I am clear on what you want, but would determining if the point is inside a bounding box based on the distance you are using now for classification give you the desired results? – Paul H. Nov 13 '17 at 18:18
  • Something like that, my final goal is to do 3d point cloud instance segmentation, and this part is about classify the points according to the distance from the center to the bounding box, to forward them to a point cloud classification network, similar to the watershed transform for 2d instance segmentation – raizend1 Nov 14 '17 at 16:28

0 Answers0