CV Crop by BBoxes
Crops one region per bounding box, in the SOURCE'S OWN TYPE - IMAGE, MASK, NPARRAY or LATENT all work, and the slice is exact (no uint8 round trip), so crop -> process -> 'CV Paste by BBox' is lossless. The policy MODE picks the use case: '-> batch' stacks every crop at one common size (downstream runs once - the inpainting case), '-> list' emits one item per region at its own tight size (downstream runs once per region). The 'per-frame' modes pair region group g with frame g of a batch instead of reading frame 0. Several BOUNDING_BOX values wired in are simply concatenated - the type already nests one group per frame, so there is no separate 'box list' input. Boxes are in the source's own coordinate space (use 'CV Scale BBoxes' for a LATENT). Empty input yields an empty batch and never raises.
- source
- bboxes
- crops
- bboxes
- width
- height
- count
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| source | COMFY_MATCHTYPE_V3 | What to crop. IMAGE / MASK / NPARRAY / LATENT; the crops come back in the same type. A batch - or several inputs - flattens into one frame sequence. | |
| bboxes | BOUNDING_BOX | [object Object] | Core BOUNDING_BOX data: per-frame lists of {x, y, width, height} dicts - compatible with Draw BBoxes, Crop By Bounding Boxes, Image Crop, etc. Boxes in the source's coordinate space. The per-frame nesting IS the grouping; several values are concatenated. |
| policyopt | STRING | one source, regions -> batch | Which use case this crop serves. 'one source, regions -> batch' crops every region out of frame 0 at one common size and stacks them (the inpainting case - downstream runs once on the batch). '-> list' instead emits one item per region at its own tight size, so downstream runs once per region. The 'per-frame' modes pair region group g with frame g of a batch instead of always reading frame 0. Crop policy. In the UI this is a mode dropdown plus one widget per option; wire an 'CV Snap BBoxes' node in to drive several crop nodes from one place (the widgets then hide). A linked policy overrides only the fields it actually sets. Boxes are always clamped inside the source. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| crops | COMFY_MATCHTYPE_V3 | One stacked batch (batch modes) or one item per region (list modes), in the source's own type. |
| bboxes | BOUNDING_BOX | Core BOUNDING_BOX data: per-frame lists of {x, y, width, height} dicts - compatible with Draw BBoxes, Crop By Bounding Boxes, Image Crop, etc. The SNAPPED boxes actually cropped, fanned out in lockstep with 'crops' - feed these to 'OpenCV Paste by BBox', not the input boxes. |
| width | INT | Crop width (the largest one when sizes vary). |
| height | INT | Crop height (the largest one when sizes vary). |
| count | INT | Number of crops (regions), whatever the output shape. |