Mask Composite Processor

Overview

The Mask Composite processor takes pre‑computed mask PNGs and combines them via the same Boolean‑DSL you use in Mask Maker. Simply feed it your individual mask files and tell it how to compose them.

Supports grayscale mask inputs (0–255) as well as color‑converted PNGs; composites operate on intensity values.


Example Usage

- processor:
    processor: "mask_composite"
    inputs:
      car: "mem/mask_car.png"
      window: "mem/mask_window.png"
      license_plate: "mem/mask_license_plate.png"
    params:
      mask_output: > # compose new masks
        body:  car - window;
        plate: car & license_plate;
    outputs:
      body: "mem/mask_body.png" # <mask> key corresponds to the 'body' composite
      plate: "mem/mask_plate.png" # <mask> key corresponds to the 'plate' composite
    assigns:
      left: "composite_left" # global bbox of all composite masks
      top: "composite_top"
      right: "composite_right"
      bottom: "composite_bottom"
      width: "composite_width"
      height: "composite_height"
      body_left: "body_left" # per-mask bbox: '{mask}_left'
      body_top: "body_top"
      plate_left: "plate_left"
      plate_top: "plate_top"

Parameters

Key Type Req’d Default Description
mask_output str Yes DSL expressions defining composites from input masks

Mask-Output DSL

Compose new masks by combining existing mask inputs using Boolean operators. Syntax:

{new_mask}: {mask1} [OP {mask2} …]; {new_mask2}: …

Examples:

mask_output: "body: car - window; plate: window & license_plate"
Syntax Alias Meaning Example
A & B AND intersection a & b → both
A + BA | B OR union a + b → either
A - B difference (A & ¬B) a - b → a only
A ^ B XOR exclusive or a ^ b → one
!A NOT complement !a → everything but a

Outputs

Key Required Description
{mask} Yes Path to each resulting composite mask PNG (body, plate)

Assigns

After processing, you’ll receive:

Replace {mask} with your composite key names (e.g. body_left, plate_width).


Just declare:

  1. Which masks to combine (inputs)
  2. How to compose them (mask_output DSL)
  3. Where to save each output (outputs)