List of points in the shape of rectangles - which point is the corner?
3 views (last 30 days)
Show older comments
I have thousands of points (x,y,z) that make up 4 distinct rectangles. How can I find the 4 corners of each rectangle?
i.e. x=[]; y=[]; z=[]; & scatter3(x,y,z) shows a couple rectangles (randomly oriented) densely made of points. I want to know the x,y,z of the corners. I attached a screenshot of the graph and the M-File.
These rectangles are not touching, and we don't know what points belong to what rectangle.
0 Comments
Accepted Answer
Image Analyst
on 17 Oct 2016
Do the rectangles overlap?
Do you know which rectangle each point belongs to? Or do we have to figure that out, like via kmeans() or some other clustering method?
You forgot to attach your data file, code to read it in, and a screenshot. Can you do so, to make it easier for people to help you?
Once you know which rectangle the points belong to, then you can John D'Errico's minboundrect() to find the corner points. http://www.mathworks.com/matlabcentral/fileexchange/34767-a-suite-of-minimal-bounding-objects
4 Comments
Image Analyst
on 17 Oct 2016
See my shape recognition demo, attached. It shows you how you can get the vertices of shapes. I'd do something along those lines. You can do it with points - it doesn't have to be an image - just do the same concept.
More Answers (0)
See Also
Categories
Find more on Point Cloud Processing 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!