Esempio n. 1
0
def detect(nl_img, size, points):
    thresh = LAT(nl_img)
    wt = weight.bright2dark(thresh)

    W = np.ones((size[0], size[1]+2))
    for i in range(size[0]):
        for j in range(1, size[1]+1):
            W[i][j] = wt[i][j-1]
    s1 = [0, points[0]]
    s2 = [size[0]-1, points[1]]

    D = fastsweeping(W, (size[0], size[1]+2), s1, s2)
    res = gradientFlow(D, s1, s2)

    return res
def detect(is_os, img, wt, size, points):
    temp = np.zeros(size)
    for j in range(size[1]):
        for i in range(size[0] - 1, 0, -1):
            if is_os[i - 1][j] > 0:
                break
            temp[i][j] = wt[i][j]

    W = np.ones((size[0], size[1] + 2))
    for i in range(size[0]):
        for j in range(1, size[1] + 1):
            W[i][j] = temp[i][j - 1]
    s1 = [0, points[0]]
    s2 = [size[0] - 1, points[1]]

    D = fastsweeping(W, (size[0], size[1] + 2), s1, s2)
    res = gradientFlow(D, s1, s2)

    return res
Esempio n. 3
0
def detect(ilm, onl_is, img, wt, size, points):
    flag = 0
    temp = np.zeros(size)
    for j in range(size[1]):
        for i in range(1, size[0]):
            if ilm[i - 10][j] > 0:
                flag = 1
            if onl_is[i][j] > 0:
                flag = 0
            temp[i][j] = flag * wt[i][j]

    W = np.ones((size[0], size[1] + 2))
    for i in range(size[0]):
        for j in range(1, size[1] + 1):
            W[i][j] = temp[i][j - 1]
    s1 = [0, points[0]]
    s2 = [size[0] - 1, points[1]]

    D = fastsweeping(W, (size[0], size[1] + 2), s1, s2)
    res = gradientFlow(D, s1, s2)

    return res