Bim_segmowgli.py 文件源码

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

项目:balu-python 作者: dipaco 项目源码 文件源码
def edge_LoG(I, sigma):
    LoG = laplace(gaussian(I, sigma=sigma), ksize=3)
    thres = np.absolute(LoG).mean() * 1.0
    output = sp.zeros(LoG.shape)
    w = output.shape[1]
    h = output.shape[0]

    for y in range(1, h - 1):
        for x in range(1, w - 1):
            patch = LoG[y - 1:y + 2, x - 1:x + 2]
            p = LoG[y, x]
            maxP = patch.max()
            minP = patch.min()
            if p > 0:
                zeroCross = True if minP < 0 else False
            else:
                zeroCross = True if maxP > 0 else False
            if ((maxP - minP) > thres) and zeroCross:
                output[y, x] = 1

    #FIXME: It is necesary to define if return the closing of the output or just the output
    #return binary_closing(output)
    return output
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号