【发布时间】:2016-08-08 16:42:09
【问题描述】:
在寻找如何使用图像处理工具“描述”任何类型的图像和形状的示例时,我偶然发现了 Scikit-image skimage.measure.moments_central(image, cr, cc, order=3) 函数。
他们举了一个如何使用这个功能的例子:
from skimage import measure #Package name in Enthought Canopy
import numpy as np
image = np.zeros((20, 20), dtype=np.double) #Square image of zeros
image[13:17, 13:17] = 1 #Adding a square of 1s
m = moments(image)
cr = m[0, 1] / m[0, 0] #Row of the centroid (x coordinate)
cc = m[1, 0] / m[0, 0] #Column of the centroid (y coordinate)
In[1]: moments_central(image, cr, cc)
Out[1]:
array([[ 16., 0., 20., 0.],
[ 0., 0., 0., 0.],
[ 20., 0., 25., 0.],
[ 0., 0., 0., 0.]])
1)每个值代表什么?由于(0,0)元素是16,我得到这个数字对应于1s平方的面积,因此它是mu零零。但是其他人呢?
2) 这总是对称矩阵吗?
3) 与著名的第二中心矩相关的值是什么?
【问题讨论】:
-
我已提交问题以改进文档:github.com/scikit-image/scikit-image/issues/2239
标签: python image-processing canopy scikit-image