boolImg.py 文件源码

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

项目:imgProcessor 作者: radjkarl 项目源码 文件源码
def boolMasksToImage(masks):
    '''
    Transform at maximum 8 bool layers --> 2d arrays, dtype=(bool,int)
    to one 8bit image
    '''
    assert len(masks) <= 8, 'can only transform up to 8 masks into image'
    masks = np.asarray(masks, dtype=np.uint8)
    assert masks.ndim == 3, 'layers need to be stack of 2d arrays'
    return np.packbits(masks, axis=0)[0].T
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号