Skip to content

v1.3.0 — Mask Post-Processing & Color Decontamination

Latest

Choose a tag to compare

@MujahidAbbas MujahidAbbas released this 16 Feb 22:18
bda5f58

What's New

Mask Post-Processing Pipeline

Added a research-backed post-processing pipeline for segmentation masks that follows BRIA's official recommendations:

  • Min-max alpha normalization — preserves the model's soft alpha matte while using the full 0-255 dynamic range (replaces destructive sigmoid thresholding)
  • Morphological opening (erode + dilate) — removes edge noise without permanently shrinking the mask boundary
  • Gaussian blur — smooth anti-aliased edges at mask boundaries

Color Decontamination

Added Photoshop-style "Decontaminate Colors" at compositing time:

  • Propagates clean foreground RGB into semi-transparent edge pixels
  • Eliminates background color fringe (e.g. green/blue spill from colored backgrounds)
  • Runs automatically at render time so brush tool edits are always decontaminated

Files Changed

  • src/lib/maskPostProcessing.ts (new) — post-processing algorithms + color decontamination
  • src/lib/segmentation.ts — integrated mask post-processing into rawImageToCanvas()
  • src/lib/compositing.ts — integrated color decontamination into drawMaskedForeground()