How do I find the centre of gravity for an irregular shape?
30 次查看(过去 30 天)
显示 更早的评论
I have given the marked coordinates and region of interest in which I would like to find the centre of gravity for, please help me.
2 个评论
采纳的回答
Bruno Luong
2019-7-15
You can get the coordinates of the centroid if you have a boundary coordinates of a polygonal region:
[xc,yc] = polygoncentroid(x_poly,y_poly)
using this function
function [xc,yc] = polygoncentroid(x,y)
xn = circshift(x,-1);
yn = circshift(y,-1);
A = x.*yn-xn.*y;
a = 3*sum(A);
xc = sum((x+xn).*A)/a;
yc = sum((y+yn).*A)/a;
end
更多回答(1 个)
Kaustav Bhattacharya
2019-7-2
Refer this link. It might help. https://in.mathworks.com/matlabcentral/answers/339583-hellou-could-i-ask-for-help-finding-the-center-of-gravity-of-the-object
4 个评论
Jan
2019-7-15
编辑:Jan
2019-7-15
The DICOM format is a file format. You have loaded the data from a MAT file. Therefore I think, that "DICOM format" is neither possible, nor does it explain, how the data are represented. All we know currently is that your data are not a binary image. Please provide any explicit details about the input. It would be inefficient if the readers guess, which data you have.
What do you exactly get for:
data = load('ROI1.mat')
Loading data directly into the workspace is prone to bugs. Prefer to catch the data in a variable like in my example.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!