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?