model_theta.py 文件源码

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

项目:CElegansBehaviour 作者: ChristophKirst 项目源码 文件源码
def mask(self, size = (151, 151)):
    """Returns a binary mask for the worm shape

    Arguments:
      size (tuple ro array): size of the mask

    Returns:
      array: mask of worm shape
    """

    mask = np.zeros(tuple(size));
    left, right = self.shape();

    for i in range(self.npoints-1):
      poly = np.array([left[i,:], right[i,:], right[i+1,:], left[i+1,:]], dtype = np.int32)
      cv2.fillPoly(mask, [poly], 1);

    return np.asarray(mask, dtype = bool)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号