Hi! I am trying to use KDTreeFLANN’s search_hybrid_vector_xd or KDTreeFLANN’s search_hybrid_vector_3d to find nearest neighbors across distance and color (i.e. find the nearest blue points in a group of black points). I read the tutorial (http://www.open3d.org/docs/release/tutorial/geometry/kdtree.html#Build-KDTree-from-point-cloud) and I understand 2/3 outputs you get: k, idx. I’m not sure what the _ output is in the tutorial and if it will help me with my question. If not, I guess an easy way to answer without going into all the technical details would be to answer, does the method access the pcd.colors values and/or can it?
I know how hard it is to get any answer here. So while I cannot answer your question directly, I can tell you what I use for colour segmentation of pcd.colors.
I also use a 4 dimensional segmentation …by including a distance in there as well.
I use KMeans…
from sklearn.cluster import KMeans
I then convert pcd.colors to an array…
cols = np.asarray(pcd.colors)
Then convert that to HSV.
Then I normalise that HSV image to maximum HSV values of 180, 255,255…we can call it cols_hsv
kmeans = KMeans(N_clusters = 8) #or however many you need
y_km = kmeans.fit_predict(cols_hsv)
Then you can use y_km as an index vector.
Sorry…Id post code in here, but I don’t have it to hand at the moment.
Thank you! I thought I would probably have to go back and put everything into numpy, if there wasn’t a good way to access in open3d. Appreciate your response!