how to generate bounding box coordinates from centroid location

2 ビュー (過去 30 日間)
manoj sain
manoj sain 2021 年 2 月 3 日
編集済み: Matt J 2021 年 2 月 3 日
polyin=[235.798080444336 161.207092285156
248.257690429688 206.053085327148
340.019195556641 180.559265136719
327.559875488281 135.713150024414]
[x,y] = centroid(polyin);
i want the bounding box coordinates from output [x y].
please help

回答 (1 件)

Matt J
Matt J 2021 年 2 月 3 日
編集済み: Matt J 2021 年 2 月 3 日
The centroid alone does not carry enough information to determine the bounding box, but you can instead do
polyin=[235.798080444336 161.207092285156
248.257690429688 206.053085327148
340.019195556641 180.559265136719
327.559875488281 135.713150024414];
[xlim,ylim] = boundingbox( polyshape(polyin) )
xlim = 1×2
235.7981 340.0192
ylim = 1×2
135.7132 206.0531

カテゴリ

Help Center および File ExchangeElementary Polygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by