common.py 文件源码

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

项目:char_segmentation 作者: CoinLQ 项目源码 文件源码
def binarisation(src_image):
    if len(src_image.shape) == 3:
        image = (src_image.sum(axis=2) / 3).astype('ubyte')
    else:
        image = src_image
    thresh = threshold_otsu(image)
    binary = (image > thresh).astype('ubyte')
    binary1 = 1 - binary
    im = 255 - np.multiply(255 - image, binary1)
    block_size = 35
    binary = threshold_adaptive(im, block_size, offset=20)
    binary = binary.astype('ubyte')
    return binary
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号