Set up selfie segmentation
setup_segmentationLoads MediaPipe selfie segmentation in TouchDesigner, building an alpha-mask Null TOP with optional inversion and feathering, plus a pre-keyed RGBA Null TOP for person-on-transparent.
Instructions
One-shot selfie segmentation via the MediaPipe TouchDesigner engine (install with tdmcp install mediapipe-touchdesigner). Loads the engine, enables Selfie Segmentation, and builds an adapter COMP with a clean alpha-mask Null TOP (optionally inverted and/or feathered) plus an optional pre-keyed RGBA Null TOP (person on transparent). Wire the mask into create_keyer, create_depth_silhouette, or any matte-consuming tool. The engine reuses an existing MediaPipe op if already loaded (idempotent). Keep the TD timeline PLAYING so the embedded browser captures the webcam; click Allow if macOS prompts for camera permission.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tox_path | No | Path to the MediaPipe ENGINE .tox (MediaPipe.tox). Defaults to the package staged by `tdmcp install mediapipe-touchdesigner`, falling back to the legacy ~/tdmcp-packages path. | |
| parent_path | No | COMP to load the engine into. Reuses the existing engine if MediaPipe already exists. | /project1 |
| model | No | Selfie-segmentation model variant. 'general' works at any orientation; 'landscape' is tuned for wide-angle scenes. | general |
| smooth | No | Enable the engine's mask temporal smoothing parameter if present. | |
| publish_prekeyed | No | Also build a person_rgba Null TOP (camera × mask) so you can drop 'person on transparent' straight into a comp. | |
| invert_mask | No | Output 1 − mask (useful for background-only effects). Applied via a Level TOP on the mask branch. | |
| feather_px | No | Soft-edge blur radius on the mask before publishing (Blur TOP). 0 = hard mask. | |
| name | No | Adapter COMP name under parent_path. Defaults to 'mp_segmentation'. |