K-means clustering of 3D point cloud

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일

0 개 추천

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

카테고리

질문:

2019년 3월 11일

답변:

2022년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by