I want to find use regioprops and find the centroid of this shape along with other properties such as area of this shape. any ideas?

2 ビュー (過去 30 日間)

採用された回答

Walter Roberson
Walter Roberson 2022 年 8 月 11 日
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1094395/image.jpeg';
img = imread(filename);
bw = im2bw(img);
imshow(bw)
props = regionprops(bw, 'Area', 'Centroid');
props
props = struct with fields:
Area: 50890 Centroid: [209.7235 135.0689]
  2 件のコメント
Diwakar Awate
Diwakar Awate 2022 年 8 月 11 日
Thanks a lot! I guess I was overthinking, this one's so easy!
Walter Roberson
Walter Roberson 2022 年 8 月 12 日
The im2bw step is important here. jpeg files are almost always rgb files.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2022 年 8 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by