Center of Mass

版本 1.0.0.0 (1.9 KB) 作者: Jered Wells
CENTEROFMASS finds the center of mass of the N-dimensional input array
4.4K 次下载
更新时间 2013/5/8

查看许可证

centerOfMass(A) finds the gray-level-weighted center of mass of the
N-dimensional numerical array A. A must be real and finite. A warning
is issued if A contains any negative values. Any NaN elements of A will
automatically be ignored. centerOfMass produces center of mass
coordinates in units of pixels. An empty array is returned if the
center of mass is undefined.

The center of mass is reported under the assumption that the first
pixel in each array dimension is centered at 1.

Also note that numerical arrays other than DOUBLE and SINGLE are
converted to SINGLE in order to prevent numerical roundoff error.

Examples:
A = rgb2gray(imread('saturn.png'));
C = centerOfMass(A);

figure; imagesc(A); colormap gray; axis image
hold on; plot(C(2),C(1),'rx')

引用格式

Jered Wells (2024). Center of Mass (https://www.mathworks.com/matlabcentral/fileexchange/41675-center-of-mass), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2013a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0