M 039 / 18302 Masks & Controlalgorithm output

Trimap

segmentation, masks & control

Typeface · Work Sans

Real-world algorithm demonstration, applied to a NASA portrait.
Real-world algorithm demonstration, applied to a NASA portrait.Image: NASA / Eileen Collins · scikit-image (public domain)View source ↗

Prompt

Transform this image into a Trimap with exactly three flat tones: white for definite foreground, black for definite background, and middle gray for the uncertain boundary band. Widen gray zones around hair and intricate edges, using crisp transitions without gradients or photographic texture. Keep the original subject and composition.

Identify

Black, white, and gray define background, foreground, and uncertainty.

Principle

A hard mask is eroded and dilated1; the edge zone2 remains unknown.

Try it out

Estimate where hair becomes problematic.

Classification

Calculated image processing result.

Further examples · 7 images

Trimap example
02 Trimap exampleA silhouette is divided into three distinct color regions of white, black, and gray. It serves as a clear example by isolating the unknown boundary region for complex matte extraction.Qsorter · CC BY-SA 4.0 · Wikimedia Commons
Trimap, applied to “Sent, (1430 m.) dorp in kanton Graubünden in Zwitserland 09-09-2019 (actm.) 20”
03 Trimap, applied to “Sent, (1430 m.) dorp in kanton Graubünden in Zwitserland 09-09-2019 (actm.) 20”A metal door latch is isolated with a white core and black background. A gray border follows the contours to mark the transition zone between foreground and background.Agnes Monkelbaan (photo); processed for the Atlas · CC BY-SA 4.0 · Wikimedia Commons
Trimap, applied to “Christmas table (Serbian cuisine)”
04 Trimap, applied to “Christmas table (Serbian cuisine)”The plates of food on a table are represented by white regions. Gray bands surround these areas, designating the edges as unknown for matting calculations.Petar Milošević (photo); processed for the Atlas · CC BY-SA 4.0 · Wikimedia Commons
Trimap, applied to “Panixersee (Lag da Pigniu) boven Andiast. 26-09-2025. (d.j.b.) 14”
05 Trimap, applied to “Panixersee (Lag da Pigniu) boven Andiast. 26-09-2025. (d.j.b.) 14”A mountain landscape is divided into a white foreground peak and black background. The gray boundary indicates the uncertainty zone along the rocky ridge.Dominicus Johannes Bergsma. (photo); processed for the Atlas · CC BY-SA 4.0 · Wikimedia Commons
Trimap, applied to “Mount Hagen Cultural Show, Papua New Guinea, 2009”
06 Trimap, applied to “Mount Hagen Cultural Show, Papua New Guinea, 2009”A person in ceremonial dress is shown with a white mask. The gray area correctly encompasses the complex feathers and headwear where hair-like details become problematic.Yves Picq (photo); processed for the Atlas · CC BY-SA 3.0 · Wikimedia Commons
Trimap, applied to “S-charl richting Alp Sesvenna. 12-10-2024. (actm.)”
07 Trimap, applied to “S-charl richting Alp Sesvenna. 12-10-2024. (actm.)”A wooden cabin is masked with a white interior and black exterior. A thick gray border defines the unknown region along the roof and wall edges.Agnes Monkelbaan (photo); processed for the Atlas · CC BY-SA 4.0 · Wikimedia Commons