www.gusucode.com > vision 源码程序 matlab案例代码 > vision/FindKNearestNeighborsExample.m
%% Find K-Nearest Neighbors in a Point Cloud % Create a point cloud object with randomly generated points. % Copyright 2015 The MathWorks, Inc. ptCloud = pointCloud(1000*rand(100,3,'single')); %% % Define a query point and the number of neighbors. point = [50,50,50]; K = 10; %% % Get the indices and the distances of 10 nearest points. [indices,dists] = findNearestNeighbors(ptCloud,point,K);