pointextractor.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:opentrack-prototyping 作者: DaMichel 项目源码 文件源码
def __call__(self, roi_slice, num):
    blob_labels = self.blob_labels[roi_slice]
    # everthing not pertaining to blobs becomes 1
    binary = (blob_labels >= 255).astype(np.uint8)
    blob_mask = (blob_labels == num)
    dist, voronoilabels = cv2.distanceTransformWithLabels(binary, cv2.DIST_L2, 3)
    vl = set(voronoilabels[blob_mask])
    if len(vl) != 1:
      print 'WARNING: In MaskVoronoiLocal, more than one label pertains to the area of the blob.'
      return np.ones(blob_labels.shape, np.bool)
    vl = vl.pop()
#    plt.imshow(binary)
#    plt.colorbar()
#    plt.show()
#    plt.imshow(voronoilabels)
#    plt.colorbar()
#    plt.show()
    return voronoilabels == vl
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号