Filtering outlier in 2D coordinate data
Show older comments
Hi experts,
I need your help to remove some outliers in my 2D coordinate data shown below.
At, at least, four locations, there are some outliers that need to be removed from my data. Please see some spikes in the plots (in red circles).
Does anyone have an algoritm, or can suggest one, that can be used to detect and move (or replace) those values?
Note that I may have several problems with slightly different cases, e.g. the number of points of the outliers may be more or less than the one shown here.
PS.
I have attached a txt file containing the 2D coordinate in this post.

7 Comments
Image Analyst
on 17 May 2019
Edited: Image Analyst
on 17 May 2019
Please explain the data format, or how you read it in. When I use
xy = dlmread('data.txt', ' ');
I get a a 2687 by 14 array. And the x and y coordinates seem to wander from one column to the next instead of being, like, all of column 1 are the x and all of column 2 are the y. What's going on?
BeeTiaw
on 17 May 2019
Image Analyst
on 17 May 2019
What are the protruding shapes called? Are these ears or tabs not always in the same indexes for some reason? If not, why not? If not the same indexes, then are in they the same x,y location, like so you could use a template or mask to mask them out?
Image Analyst
on 17 May 2019
Not really, other than we now know the shapes are called "spikes". We don't know the answers to my questions about whether they are at the same index, or same location.
And also, what if the "spikes" take up a much larger portion of the shape? Like what if the spikes are 30%, 50% or 75% of the image? What parameters do you have restricting the problem. For example if the spikes are taking up 80% then you'd have inward pointing spikes and some algorithms would identify the outward pointing 80% as the spikes. Is that what you want? That the outward pointing ones are always what you want no matter if they end up being the "dominant' smooth shape and not spikes at all?
Jacek Wodecki
on 20 Aug 2025
Unfold the shape by converting to polar coordinates and plotting rho vs theta. Then, when you effectively have the 1D signal, segment out the sections that are indicated by significant spikes in the derivative.
Accepted Answer
More Answers (0)
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
