FocalpointFromSegs
Turn face detection into a crop center, automatically
- segs
- X
- Y
- MinX
- MaxX
- MinY
- MaxY
- Width
- Height
The annoying half of any focal crop is finding the focal point. Focalpoint from SEGS is the "automatic" button: feed it a SEGS from any Impact Pack detector and it averages the centers of all detected segments into a single X, Y you can wire straight into Focal Rescale - no hand-placing a crop box ever again.
If you haven't met SEGS yet: it's the Impact Pack's container for "a set of detected segments" - the output of nodes like BBOX and SEGM detectors (and their SAM-refined variants) that find faces, hands, and people in an image. In the wider detect-crop-refine ecosystem, SEGS is plumbing: a detector emits it, a detailer consumes it, a paste node composites it back. This node is an unusual consumer in that it refines nothing - it just does arithmetic on the segment bounding boxes and emits coordinates.
How it works
For every segment, the node reads crop_region (the detection's bounding box), accumulates the corner coordinates, and averages them. The result: X and Y, the mean center of everything that was detected. In the same pass it tracks the extremes, so you also get MinX, MaxX, MinY, MaxY - the bounding box around all segments - and Width / Height derived from that. One clean face detection gives you its center and its box; a crowd gives you the average of the crowd plus the group's footprint.
This is the exact pipeline the author built the node for. His original r/comfyui announcement showed a face detection feeding a focal rescale so any image could become a 16:9 img2img canvas with the faces kept in frame - a workflow he'd been doing by hand before the pack existed.
Inputs and outputs
Input: segs (SEGS), and that's it. No knobs, which is the point - the node exists to remove a decision.
Outputs: X, Y (the averaged center, INT) are the two you'll actually use. The rest - MinX / MaxX / MinY / MaxY / Width / Height - describe the group's bounding box, useful if you want the full extent of the detections rather than the centroid.
The setup
Load Image → face BBOX detector (Impact Pack) → Focalpoint from SEGS → X and Y into Focal Rescale's focalx / focaly → out comes a canvas that keeps every face in frame, at whatever aspect ratio you picked. You can also chain it into Focal Rescale Rel, whose relative focal inputs accept the normalized versions.
Gotchas
The average is a plain mean, and detectors over-trigger. If your detector fires on twelve background "faces," the focal point drifts toward their average and your real subject ends up off-center. Filter your SEGS first - keep only large or high-confidence segments - before averaging. And note the minor pedantry: averaging the bbox corners is essentially the center for a single clean detection, but with overlapping segments the mean of corners is a hair off the true centroid. For one face, they're the same thing.
You'll need Impact Pack installed alongside this pack to have anything producing SEGS - it's a separate install from the same ComfyUI Manager, and the de facto standard for detection in ComfyUI.
Installing it
The pack itself has zero extra dependencies - pure image math. ComfyUI Manager: search for Comfy_Felsirnodes (or "Felsir"), install, restart; grab Impact Pack too while you're there. Manual: cd ComfyUI/custom_nodes and git clone https://github.com/Felsir/Comfy_Felsirnodes, restart. The node is under Add Node → Felsir.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| segs | SEGS | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| X | INT | — |
| Y | INT | — |
| MinX | INT | — |
| MaxX | INT | — |
| MinY | INT | — |
| MaxY | INT | — |
| Width | INT | — |
| Height | INT | — |