K-means clustering of 3D point cloud

36 次查看(过去 30 天)
I have a 3D point cloud (ptCloud) with these data:
  • Location [x,y,z]
  • Intensity (I used some kind of vegetation index - GRVI)
Now, I want to perform k-means clustering to segment the vegetation part of the 3D point cloud.
I tried this:
group = imsegkmeans3(ptCloud,3)
But it does not accept a point cloud as "volume to segment"
How else can I perform k-means clustering of the point cloud based on the intensity values (GRVI)?
My MatLab is R2018b.
  1 个评论
Tiago Ramos
Tiago Ramos 2020-4-14
Perhaps use "kmeans" and not imsekgmeans3.
I would use kmeans in the GRVI values and use the output indices to create the groups. something like
ii = kmeans(GRVI,3);
ptCloud1 = ptCloud(ii==1,:);
ptCloud2 = ptCloud(ii==2,:);
ptCloud3 = ptCloud(ii==3,:);

请先登录,再进行评论。

回答(1 个)

Paola Donis Noriega
Hi Addie,
You can segment the point cloud based on its intensity values using either imsegkmeans or kmeans. imsegkmeans3 is to segment volumes, so it wouldn't work for the data stored in the intensity property of the point cloud. Consider the following example:
% Load location and intensity data.
ld = load('drivingLidarPoints.mat');
location = ld.ptCloud.Location;
intensity = ld.ptCloud.Intensity; % In your use case, intensity would be the vegetation index.
% Create a point cloud object with the location and intensity data.
% Notice that imsegkmeans supports inputs of type uint8, uint16, int8,
% int16 and single.
ptCloud = pointCloud(location, "Intensity", uint8(intensity));
% Segment based on intensity values.
numClusters = 10;
labels = imsegkmeans(ptCloud.Intensity, numClusters);
% Select each cluster and store it in a pointCloud object.
ptCloudArr = pointCloud.empty(0, numClusters);
for i = 1:numClusters
ptCloudArr(i) = select(ptCloud, labels == i);
end
% Optional: you can also visualize each cluster as follows.
colorsPlot = lines(numClusters);
for k = 1:numClusters
pcshow(ptCloudArr(k).Location, colorsPlot(k,:))
hold on
end

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by