remove outliers in 3D point data

Hi guys, I want to thank you in advance for you help. I have a point cloud of an object, separated by axis:
points = [x, y, z];
which when plotted on a scatter contain some outliers that I want to get rid of.
I've already got a distance matrix of the point set using the following code:
distanceMatrix = squareform(pdist(points, 'euclidean'));
I can use logical indexing to remove distances beyond a certain standard deviation (I'm using 1 here),
newDistanceM = distanceMatrix>mean(mean(distanceMatrix))+1*std(std(distanceMatrix));
Where I am having trouble is using newDistanceM to filter out the points that are outliers in my original set. It's probably really simple to do this but I'm not seeing it.
Any help on this is, of course, greatly appreciated and if anybody has a better/more robust way of achieving what I describe, I very much welcome the feedback.
Cheers

2 件のコメント

Baltam
Baltam 2016 年 4 月 18 日
Are you sure you are calculating the correct distance? If you need the distance of each point to the origin than you should use:
points = rand(50,3);
distance = sqrt(sum(points.^2,2));
indices = distance<(mean(distance)+std(distance)); %note I use smaller than instead of bigger
remainingPoints = points(indices,:);
jay
jay 2016 年 4 月 18 日
thanks for this comment, it's helped me correct what I was doing. Cheers!

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

 採用された回答

Image Analyst
Image Analyst 2016 年 4 月 18 日

0 投票

Brett uploaded an outlier removal tool that uses Grubbs test: http://www.mathworks.com/matlabcentral/fileexchange/3961-deleteoutliers
I tend to like the median absolute deviation. Compute distances from the centroid (mean x, y, z) and get rid of points where the distance is greater than some factor times the MAD value.
Attached is an example of how to use MAD to get rid of Salt and Pepper noise.

1 件のコメント

jay
jay 2016 年 4 月 18 日
Thanks for the attached file, it was very infromative!!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeFit Postprocessing についてさらに検索

質問済み:

jay
2016 年 4 月 18 日

コメント済み:

jay
2016 年 4 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by