Skip to content

have a error when get trimap from alpha #5

@XH-B

Description

@XH-B

def gen_trimap(alpha):
k_size = random.choice(range(5, 10)) # 随机选择核大小
iterations = np.random.randint(1, 20)
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (k_size, k_size))
dilated = cv2.dilate(alpha, kernel, iterations)
eroded = cv2.erode(alpha, kernel, iterations)
trimap = np.zeros(alpha.shape)
trimap.fill(128)
trimap[eroded >= 254] = 255
trimap[dilated <= 0] = 0

return trimap

I use this code to get trimap from alpha, and use this trimap for OTVM model, but the predict result is wrong, and even the trimap_gt generated (only red,green,no blue) is different from the the input, it is amazing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions