skel2d.py 文件源码

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

项目:imagepy 作者: Image-Py 项目源码 文件源码
def check(n):
    a = [(n>>i) & 1 for i in range(8)]
    a.insert(4, 0) # make the 3x3 unit
    # if up, down, left, right all are 1, you cannot make a hole
    if a[1] & a[3] & a[5] & a[7]:return False
    #if sum(a)==1: return False
    a = np.array(a).reshape((3,3))
    # segments
    n = label(a, strc)[1]
    # if sum is 0, it is a isolate point, you cannot remove it.
    # if number of segments > 2, you cannot split them.
    return n<2
    return a.sum()>1 and n<2
    if a.sum()==1 or n>2: return 2
    if a.sum()>1 and n<2: return 1
    return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号