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}: …
{mask1}
etc. refer to input keys (e.g.car
,window
) or earlier composites.- Operators are left→right, no parentheses.
- Unary complement via
!
orNOT
.
Examples:
mask_output: "body: car - window; plate: window & license_plate"
Syntax | Alias | Meaning | Example |
---|---|---|---|
A & B |
AND | intersection | a & b → both |
A + B ⁄A | 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 |
- Case-insensitive.
- No parentheses; use multiple segments to chain.
Outputs
Key | Required | Description |
---|---|---|
{mask} |
Yes | Path to each resulting composite mask PNG (body , plate ) |
Assigns
After processing, you’ll receive:
- Global bbox of all composites:
left
,top
,right
,bottom
,width
,height
- Per-mask bbox:
{mask}_left
,{mask}_top
,{mask}_right
,{mask}_bottom
,{mask}_width
,{mask}_height
Replace
{mask}
with your composite key names (e.g.body_left
,plate_width
).
Just declare:
- Which masks to combine (
inputs
) - How to compose them (
mask_output
DSL) - Where to save each output (
outputs
)