二进制形状的时间序列

2024-10-04 09:19:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直致力于从形状中提取时间序列,从0到360角度顺时针从质心到距离。在

我的实现是根据轮廓点与[1,0]向量的角度来排列轮廓点,这可能对某些形状有好处,但对那些有很多清晰度的形状却没有用处。考虑以下代码:

im = Image.open(os.path.join(path,filename))

im = im.filter(ifilter.MedianFilter)

contim = im.filter(ifilter.CONTOUR)

contim = contim[1:-1,1:-1] # this is because borders are extracted here as contours

contpts = np.where(contim ==0)

contpts = np.vstack((contpts[0],contpts[1])) # Just need to arrange these points clockwise with respect to the center of mass of the shape

我可以从任何一个物体的中心提取物体的轮廓。在

有关该功能的更多信息,请参阅本文:“LB_Keogh支持在旋转不变性下使用任意表示和距离度量来精确索引形状”


Tags: ofthetopath距离npfilter物体
1条回答
网友
1楼 · 发布于 2024-10-04 09:19:10

如果我理解的话,离散平面上有一个几何图形,用矩阵表示。如果条目为1,则表示您在图形内部。如果是0,你就在外面。他想确定边缘上所有点的图形边缘和图形中心之间的距离。他用极坐标系将其参数化。图形的中心是原点,现在他想得到到边界的距离,作为角度的函数。这就是他所谓的“时间序列”。在

这是对的吗?在

如果是,你就不能:

1. determine the center of mass,
2. reposition the origin to match the center of mass. 
3. start angle at 0
4. r = 0
5. for each angle in [0,1,...,360] 
      1. If you're in inside the figure, increase r until you reach the border. 
      2. If you're outside the figure, decrease r until you reach the border.
      3. When you reach the border, d(angle) = r

如果图形有一个或多或少连续的边界,这将遵循轮廓。在

这样行吗?在

相关问题 更多 >