Nodes/ComfyUI Impact Pack/From SEG_ELT bbox
ComfyUI Node Runs on cloud

From SEG_ELT bbox

Read a detection's box coordinates as numbers

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,248
From SEG_ELT bbox
  • bbox
  • left
  • top
  • right
  • bottom

A tiny extractor: give it the bounding box of a single detection and it spits out four integers - left, top, right, bottom. That's the pixel rectangle of where the detector found the thing. If you've ever needed the actual coordinates of a detected face to drive some other part of your graph, this is how you get them out.

It lives in the experimental SEGS-manipulation corner of Impact Pack, downstream of Decompose (SEGS). You don't start here; you get here by taking a SEGS apart into individual elements first.

How it works

Recall the shape of the data. A SEGS decomposes into a header plus a list of SEG_ELT elements, one per detection. Each element carries, among other things, a bounding box - the axis-aligned rectangle around the detection. This node takes that bbox (a SEG_ELT_bbox value you pull off an element) and reads out its four edges as plain INT coordinates in pixels. No transformation, no scaling - just the raw box edges, so whatever consumes them (a crop node, a math expression, a conditional that checks size or position) gets real numbers to work with. There's a sibling for the crop region if you need that rectangle instead; this one is specifically the detection bbox.

The input and outputs

  • bbox (SEG_ELT_bbox, required) - the bounding box of one detection, typically obtained after decomposing a SEGS and reaching into an element. Only input.

Four outputs, all INT: left, top, right, bottom - the box edges in pixels. Width is right - left, height is bottom - top, if you need those (a small math node gets you there).

How to install it

Ships in Impact Pack. ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack

then pip install -r requirements.txt in ComfyUI's Python env (portable: python_embeded\python.exe -m pip ...), restart. Pack's by ltdrdata - ComfyUI-Manager's author - so it's a trusted, mainstream install. Nothing extra to download for this node.

Common issues & troubleshooting

The main thing that trips people up is the input: this wants a SEG_ELT_bbox, not a SEGS and not a whole SEG_ELT. You reach it by decomposing a SEGS into elements, then extracting the bbox off an element - the pack's SEG_ELT manipulation nodes are the path. If the socket won't connect, you're probably trying to feed it the wrong type one step too early. Also remember the element output of Decompose is a list, so if you wire it through, you'll get coordinates for every detection, not just one; use a Select Nth Item (Any) or index appropriately if you only want a specific box. And the coordinates are in the source image's pixel space - if you've resized the image elsewhere, they won't match the resized version.

CategoryImpactPack/Util

Inputs (1)

NameTypeDefaultDescription
bboxSEG_ELT_bbox

Outputs (4)

NameTypeDescription
leftINT
topINT
rightINT
bottomINT