Comparing two point clouds for differences

20 ビュー (過去 30 日間)
Michael Delpapa
Michael Delpapa 2017 年 8 月 27 日
コメント済み: Prashik Shende 2020 年 9 月 23 日
I am attempting to use two point clouds from the kinect and compare for differences between the two scenes.
The logic is as follows: For each point in point cloud 1, the distance to the nearest neighbor in point cloud 2 is calculated. If the distance is greater then the threshold distance, the indices of the point in point cloud 1 is stored. After completing for loop, the indices are used to select the points in point cloud 1 that were greater than threshold difference.
function [PCDifference] = ComparePC(pc1,pc2)
%Compares two aligned point clouds based on threshold difference
[pc1r,~]=removeInvalidPoints(pc1);
[pc2r,~]=removeInvalidPoints(pc2);
minDist = 0.5;
x=0;
%for each point in pc1 find nearest neighbor distance - if greater then
%threshold distance store point cloud in PCDifference
for i =1:pc1r.Count
point=pc1r.Location(i,:);
[~,dist]=findNearestNeighbors(pc2r,point,1);
if dist > minDist
if true
% code
end
%Store point cloud in indices
x=x+1;
Indices(x,1)=i
end
end
%Plot difference in point clouds
PCDifference=select(pc1r,Indices);
figure
pcshow(PCDifference)
I am receiving errors in PCDifference=select(pc1r,Indices) line. Indices should be a column vector with the indices of points without close neighbor. Is there a better way to approach this? There is no easy way to create point cloud object that changes size every loop. It is best to store the indices and then use the select function afterwards.
Please let me know if you have any ideas.
Thank you, Michael

回答 (1 件)

KSSV
KSSV 2017 年 8 月 27 日
Doc _ knnsearch_ ...with this you can get the indices of nearest neighbors with ease..
  1 件のコメント
Prashik Shende
Prashik Shende 2020 年 9 月 23 日
can use specify how to use knnsearch in code

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by