フィルターのクリア

K-means clustering of 3D point cloud

36 ビュー (過去 30 日間)
Addie Ira Parico
Addie Ira Parico 2019 年 3 月 11 日
回答済み: Paola Donis Noriega 2022 年 5 月 24 日
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
Paola Donis Noriega 2022 年 5 月 24 日
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 Center および File ExchangePoint Cloud Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by