A trimap labels each pixel as definite foreground, definite background, or unknown, and this problem asks you to map those labels to a simple alpha value (opacity): 1.0, 0.0, or “unknown”. In image matting, the final goal is to estimate a continuous alpha matte (values in [0,1]) that describes how much each pixel belongs to the foreground. A trimap is a coarse prior: the known regions (foreground/background) are fixed, and only the unknown band near boundaries needs more advanced estimation (e.g., closed-form matting, deep matting, etc.).
Formally, matting uses the compositing equation
I=αF+(1−α)B,
where I is the observed color, F the foreground, B the background, and α the transparency. The trimap constrains this: in known regions, α is exactly 0 or 1; in unknown regions, α must be inferred by a matting algorithm that uses local color statistics, priors, or deep networks. This exercise focuses only on the easy part: translating the trimap label into its corresponding fixed alpha or marking it as unknown.