segmentation.py 文件源码

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

项目:SegmentationService 作者: jingchaoluan 项目源码 文件源码
def compute_gradmaps(binary,scale):
    # use gradient filtering to find baselines
    boxmap = psegutils.compute_boxmap(binary,scale)
    cleaned = boxmap*binary
    DSAVE("cleaned",cleaned)
    if args['usegause']:
        # this uses Gaussians
        grad = gaussian_filter(1.0*cleaned,(args['vscale']*0.3*scale,
                                            args['hscale']*6*scale),order=(1,0))
    else:
        # this uses non-Gaussian oriented filters
        grad = gaussian_filter(1.0*cleaned,(max(4,args['vscale']*0.3*scale),
                                            args['hscale']*scale),order=(1,0))
        grad = uniform_filter(grad,(args['vscale'],args['hscale']*6*scale))
    bottom = ocrolib.norm_max((grad<0)*(-grad))
    top = ocrolib.norm_max((grad>0)*grad)
    return bottom,top,boxmap
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号