Border detection out of regular shape

3 Ansichten (letzte 30 Tage)
Albert
Albert am 8 Apr. 2022
Kommentiert: Albert am 11 Apr. 2022
Hi, I have this shape in the plot, but I want to detect the 4 tails sticking out of the square in order to remove them. How could I detect them? I only have a single vector of points (x,y) which are in the plot. Attached is the variable containing the points.
Thanks!
  4 Kommentare
Albert
Albert am 8 Apr. 2022
I have attached the mat file!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt J
Matt J am 8 Apr. 2022
Bearbeitet: Matt J am 8 Apr. 2022
load data_points
data0=data;
shp=alphaShape(data,0.9);
[~,V]=boundaryFacets(shp);
shp=polyshape(V,'Simplify',true);
Warning: Polyshape has duplicate vertices, intersections, or other inconsistencies that may produce inaccurate or unexpected results. Input data has been modified to create a well-defined polyshape.
for i=[-1,sqrt(2)]
shp=polybuffer(shp,i,'Joint','square');
end
tf=shp.isinterior(data);
data=data(tf,:);
plot(data0(:,1),data0(:,2),'o',data(:,1),data(:,2),'.r'); hold on
  3 Kommentare
Albert
Albert am 11 Apr. 2022
thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Find more on Images 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!

Translated by