def unstick_contour(edgepoints, unstick_coeff):
"""
Removes edgepoints near previously discarded points.
@type edgepoints: list[bool]
@param edgepoints: current edgepoint list
@type unstick_coeff: float
@param unstick_coeff
@return: filtered edgepoints
"""
(n, init, end) = loop_connected_components(np.logical_not(edgepoints))
filtered = np.copy(edgepoints)
n_edgepoint = len(edgepoints)
for size, s, e in zip(n, init, end):
for j in range(1, int(size * unstick_coeff + 0.5) + 1):
filtered[(e + j) % n_edgepoint] = 0
filtered[(s - j) % n_edgepoint] = 0
return filtered
评论列表
文章目录