fitting rectangle through data points
33 次查看(过去 30 天)
显示 更早的评论
采纳的回答
darova
2019-5-26
If your data always has V form (look like triangle). Tree corners can be found. Find farthest corners using pdist2()
Divide points into 2 groups. If distance point-corner smaller than radius:
Use polyfit() to calculate coeffiecients of line. What if angle between calculated lines is not 90 degree?
3 个评论
更多回答(1 个)
Image Analyst
2019-5-25
What I would try first is to use principal components analysis ("PCA") to identify the two axes. Use pca() if you have the stats toolbox. Then you can fit lines with polyfit() going through the points along each PC. Use the points at the limits to determine where the lines start and stop. Sorry, no I don't have code that does this already - I'd have to develop it just as you would.
Another method you might also try is RANSAC.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!