check if a point belongs to a point cloud?

2 views (last 30 days)
Giulia Mazzucchelli
Giulia Mazzucchelli on 17 Feb 2018
Answered: Rushil on 25 Mar 2025
Hi there,
Is there any method to check if a point belongs to a point cloud? Thanks

Answers (1)

Rushil
Rushil on 25 Mar 2025
Hello
I assume that you are making use of “pointCloud” object from Computer Vision Toolbox. In order to check whether a given point belongs to a point cloud, you can make use of the “findNearestNeighbors” function, which finds the node in the point cloud nearest to the query point. Then check if the distance is less than a certain threshold to determine whether it belongs to the point cloud. Below is implementation for the same:
data = [1, 2, 3; 4, 5, 6; 7, 8, 9]; % some point cloud data
ptCloud = pointCloud(data);
qpt = [4, 5, 6]; % point you want to check (query point)
[idx,dist] = findNearestNeighbors(ptCloud,qpt,1);
threshold = 0.01; % a threshold for "belonging" to the point cloud
isPointInCloud = dist < threshold;
disp(isPointInCloud);
You can read more about “findNearestNeighbors” here:

Tags

Community Treasure Hunt

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

Start Hunting!