center of mass of pixels in grayscale image

China☆狼群 提交于 2019-12-06 08:32:48

"Center of mass" (for binary images) is a bit convoluted way of saying "mean value across each dimension". In other words - take all x coordinates and average them - and you got x coordinate of your "center of mass", the same for y.

In python, for data in X it would be

center_of_mass = X.mean(axis=0)

If you have pixels' intensities you can use them as "weights" thus leading to weighted averages, that's all.

Here, let me search that for you ...

You multiply the distance from the mean by the weight of each pixel -- almost certainly 1.0 for your work. In short, take the mean of all x coordinates and the mean of all y coordinates; that gives you the center of mass.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!