Nodes/ComfyUI-BrainDead/BD MP Face Mask
ComfyUI Node

BD MP Face Mask

Extracts per-region face masks via MediaPipe Face Landmarker landmarks. Deterministic, CPU-only, ~5 ms per frame. No SAM3 prompts needed. Outputs face_oval, skin (face minus eyes/brows/lips), individual feature masks (eye, brow, lips, nose, ear, forehead, hair).

By BizaNator·Created 7 months ago·Updated 16 days ago· 14
BD MP Face Mask
  • image
  • head_mask
  • face_oval
  • skin
  • left_eye
  • right_eye
  • eyes
  • left_brow
  • right_brow
  • brows
  • left_iris
  • right_iris
  • irises
  • lips
  • nose
  • left_ear
  • right_ear
  • ears
  • forehead
  • hair
  • status
  • bbox_json
detection_confidence0.50
face_expand0
feature_expand4
subtract_nosefalse
iris_expand4
ear_expand25
hair_expand20
bbox_featurenone
bbox_frame0
Category🧠BrainDead/Segmentation

Inputs (11)

NameTypeDefaultDescription
imageIMAGEInput image or batch. Each frame processed independently.
head_maskoptMASKOptional external head silhouette (e.g. from SAM3). When wired, this mask is used as the base for computing 'skin' instead of MediaPipe's face_oval. MediaPipe still runs for landmark detection (eyes/brows/lips/etc.) — it just doesn't determine the head boundary. Use this when MediaPipe's oval misses bald heads, full chin edges, or unusual head shapes.
detection_confidenceoptFLOAT0.500.1–1Face detection confidence threshold.
face_expandoptINT0-30–80Pixels to expand (+) or contract (-) the face oval boundary. +4 helps catch jaw-edge hair strands.
feature_expandoptINT40–40Pixels to expand eye/brow/lip regions before subtracting from skin. Covers lashes and lip border. 3–6 px is typical.
subtract_noseoptBOOLEANfalseWhen True, nose region is also excluded from skin mask.
iris_expandoptINT40–20Pixels to expand iris landmark ring outward to fill the coloured disc. Iris ring is 4 points; 3-6 px gives a natural circle. 0 = tight hull only.
ear_expandoptINT250–80Pixels to expand ear (preauricular) region beyond the face oval edge.
hair_expandoptINT200–80Pixels to expand hair region downward into the hairline transition zone.
bbox_featureoptCOMBOnoneWhich feature to emit as a bounding box. 'none' skips bbox computation. bbox is from frame 0 (or first detected frame). Wire bbox to SAM3_Detect bboxes for box-prompted segmentation.
bbox_frameoptINT00–63Which frame index to extract the bbox from (default 0).

Outputs (20)

NameTypeDescription
face_ovalMASKComplete face silhouette (jaw to hairline). No neck, no background.
skinMASKhead_mask (if wired) or face_oval, minus eyes + brows + lips (and nose if subtract_nose). Primary skin-painting region.
left_eyeMASKLeft eye (subject's left = image right for front-facing).
right_eyeMASKRight eye (subject's right = image left for front-facing).
eyesMASKBoth eyes combined.
left_browMASKLeft eyebrow.
right_browMASKRight eyebrow.
browsMASKBoth brows combined.
left_irisMASKLeft iris disc (coloured part of eye). Requires 478-point model.
right_irisMASKRight iris disc.
irisesMASKBoth irises combined.
lipsMASKFull lip area (upper + lower, inner + outer contour).
noseMASKNose — tip, bridge, and nostril rims.
left_earMASKLeft preauricular region (near lm 234), expanded by ear_expand.
right_earMASKRight preauricular region (near lm 454).
earsMASKBoth ears combined.
foreheadMASKUpper ~40% of face_oval minus brow band.
hairMASKRegion above face oval, to image top edge.
statusSTRING
bbox_jsonSTRINGTight bbox of bbox_feature from bbox_frame as JSON string {"x","y","width","height"}. "{}"when bbox_feature='none' or face not detected. Note: BOUNDING_BOX typed output is omitted — V3 dispatcher routes the dict to the wrong downstream parameter. Use bbox_json + a JSON parse node if you need a bbox socket.