Help please, I want to find out the Centroid, Area, and the Moment of Inertia of any closed curve, from an axis line drawn under that shape. Then How to make a GUI program that displays one two-dimensional area shape along with its centroid marked on

12 次查看(过去 30 天)
Help please, I want to find out the Centroid, Area, and the Moment of Inertia of any closed curve, from an axis line drawn under that shape.
Then How to make a GUI program that displays one two-dimensional area shape along with its centroid marked on the area. It also calculates its moment of inertia for the area and displays the result? The user input is an image file that contains an arbitrary shape of closed curve on top of horizontal line that indicates the axis about which the moment of inertia is measured (refer to the image below). The length scale is defined by user referring to the distance between the axis and the centroid firstly determined.
I figured out from searching how to slect the enclosed shape, and calculate the area, but I dont know how to find out the distance from the axis line that is drwan under that curve to the determined centeroid??

采纳的回答

Image Analyst
Image Analyst 2020-4-26
Area and centroid are trivial. You just do
props = regionprops(mask, 'Area', 'Centroid');
For the moments of inertia, see my attached demo that computes image moments. I'm sure you will know how to make the obvious changes to have the line be your axis.
  1 个评论
Azad Al Kiki
Azad Al Kiki 2020-4-27
Thank you so much, you did helped me a lot.
the program asks the user to upload an image, like the attached picture, then it will show the centroid, calculates the Area, and then calculates the moments of ineria, which is the area*y^2. y is the distance from the x-axis to the centeroid. the x-axis is the drwaing line under the colsed curve.
I did the GUI program, would you please take a look at it. I dont know how to dispay the statics in the statc box when pressing the buton. i used set(handles.tagname,'string',Area,centroid,Moments of anertia) , but i get an error.
I have attached the files, please take a look. thank you

请先登录,再进行评论。

更多回答(1 个)

darova
darova 2020-4-26
  • binarize image (0 and 1)
  • label image with bwlabel (to find inside part of large blob)
  • use regionprops with centroid and area options (use area property to find appopriate centroid)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by