Matlab R2018b中新函数“ pcsegdist”的计算错误

时间:2019-03-04 08:39:27

标签: system vision toolbox

我尝试在Matlab R2018b中测试新功能“ pcsegdist ”。但是,基于欧几里得距离将点云分割成簇的结果是错误

示例:我使用3D数据点进行测试-1797点(请参见附件中的test.txt文件)。请注意,两个相邻点之间的最小距离为0.3736

tic
clear;clc;filename = 'test.txt'; load('test.txt');P = test(:,1:3);%get data=coordinate(x,y,z) from set of data "column" at (all row & column 1,2,3)
ptCloud = pointCloud(P);
minDistance = 0.71;%this value should less than the smallest 3D distance between 2 clusters
[labels,numClusters] = pcsegdist(ptCloud,minDistance);%numClusters: the number of Cluster
%labels: is the kx1 matrix. This is index of each voxel in each cluster
toc
%% Generate the cell_cluster
cell_cluster={};x=P(:,1);y=P(:,2);z=P(:,3);
for i=1:numClusters
    cluster_i=[x(labels==i),y(labels==i),z(labels==i)];%call x,y,z coord of all points which is belong the same cluster
    cell_cluster{end+1} = cluster_i;%this is (1xk)cell. where k=number of cluster
end
figure;Plot_cell(cell_cluster);view(3);% plot result cluster(using function to plot)

enter image description here 但是,当我通过手动方法(地面真实数据)进行验证时,结果应如下图所示: enter image description here enter image description here 因此,我想知道Matlab R2018b中新函数“ pcsegdist”的结果,还是我误解了或者在某个地方错了?enter link description here

0 个答案:

没有答案