Finding the distance between a large group of points from a plane
조회 수: 8 (최근 30일)
이전 댓글 표시
Hi All,
I have a large group of points scattered in front of a curtain-like wall in the 3D space. I want to find the distance of each points from the wall.
If the number of points was low, I could find the distance of each points using the least square method. In other words, I could calculate the eucleadian distance of each point from all points on the wall and then find the lowest one. However, in my problem, I have about 3 million points that are scattered in front of a wall with irregular surface that can be described using around one million points. So totally I need to calculate the distance for about 3*E12 times, which is not feasible.
Is there any image processing method by which I can find the closest point on the wall to each point in front of the wall? I mean visually we can locate a set of few points on the wall that are closest to each point in front of it. Can we do the same thing using the MATLAB image processing toolbox?
Many thanks in advance,
댓글 수: 2
Walter Roberson
2019년 12월 16일
Is the current-like wall a logical plane? Or is it wavy like is not uncommon in some curtains?
Memo Remo
2019년 12월 16일
Hi Walter, Thanks for the reply. No, the surface of the wall is highly irregular. No surface fit can be considered.
채택된 답변
Walter Roberson
2019년 12월 16일
https://www.mathworks.com/help/stats/knnsearch.html knnsearch() between the wall points and the cloud points.
This does not compare each point to each other point, not under the circumstance that the points are low dimensional and that euclidean distance is being used: instead it builds an octree or equivalent for higher dimensions.
댓글 수: 2
Image Analyst
2019년 12월 16일
How long does it take if you do this?
numPoints = 100;
xy1 = rand(3*numPoints, 2);
xy2 = rand(numPoints, 2)
tic
distances = pdist2(xy1, xy2);
toc
Gradually increase numPoints up to a million. I did 100000 on my slow computer and it tool almost 4 minutes.
But I think subsampling your data and using KNN like Walter suggested to estimate the nearby points is a good workaround that may be accurate enough for you.
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation of 2-D Selections in 3-D Grids에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!