フィルターのクリア

How to prevent Convexhull function data reduction in matlab ?

1 回表示 (過去 30 日間)
Ali Gh
Ali Gh 2018 年 7 月 11 日
回答済み: Steven Lord 2018 年 7 月 11 日
By default , convexhull function reduce the data given to it , How can we prevent it from doing it ? when this function do so , it will we useless for complicated shapes. Actually I need a Concave hull function. Thanks in advance.

回答 (1 件)

Steven Lord
Steven Lord 2018 年 7 月 11 日
Concave hulls are ambiguous, though there may be a tool that will help you that I'll mention after the example. Consider this set of points:
x = [-1 1 1 -1 0];
y = [-1 -1 1 1 0];
plot(x, y, 'o');
axis([-2 2 -2 2]);
axis square
Which would be the concave hull of this data?
figure
subplot(2, 2, 1);
plot(x([1:5 1]), y([1:5 1]), 'o-');
axis([-2 2 -2 2]);
axis square
subplot(2, 2, 2);
plot(x([1 2 5 3 4 1]), y([1 2 5 3 4 1]), 'o-');
axis([-2 2 -2 2]);
axis square
subplot(2, 2, 3);
plot(x([1 2 5 3 4 5 1]), y([1 2 5 3 4 5 1]), 'o-');
axis([-2 2 -2 2]);
axis square
subplot(2, 2, 4);
plot(x([1:4 1]), y([1:4 1]), 'o-');
hold on
plot(x(5), y(5), 'o');
axis([-2 2 -2 2]);
axis square
That being said, the alphaShape function may do what you want.
figure
plot(alphaShape(x.', y.'))
axis([-2 2 -2 2]);
axis square
Choose your alpha value carefully.

カテゴリ

Help Center および File ExchangeBounding Regions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by