CV Snap BBoxes (Crop Policy)
Authors a crop sizing policy - padding, squareness, a size that is a multiple of the VAE stride, one common size so crops stack into a batch - and fans it out: wire the 'policy' STRING output into the crop policy input of any number of 'CV Crop by BBoxes' / 'CV Crop by Masks' nodes and they all share one configuration (their own policy widgets hide while linked). Wire 'bboxes' in as well and it also returns the snapped boxes, e.g. for the core 'Draw BBoxes' or 'Crop By Bounding Boxes'. Order of operations: pad -> size mode -> square -> round up to the size multiple -> cap at max size -> clamp inside the reference space (re-centred, never resized again). The two caps round DOWN to a multiple, so a clamped crop still satisfies 'size multiple'.
- bboxes
- space
- policy
- bboxes
- width
- height
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| policy | 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. |
| bboxesopt | 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. Optional - without it the node is a pure policy source and 'bboxes' comes back empty. |
| spaceopt | NPARRAY,IMAGE,MASK,LATENT | Optional reference the snapped boxes must stay inside; only its height/width are read. Leave it unconnected to let boxes grow past the image edges (the crop nodes clamp against their own source anyway). |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| policy | STRING | The pipe-joined policy string - wire it into the 'policy' input of the crop nodes. |
| 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 (empty when no boxes were connected). |
| width | INT | Resolved crop width (the largest one in 'keep per box' mode). 0 when no boxes were connected. |
| height | INT | Resolved crop height (the largest one in 'keep per box' mode). 0 when no boxes were connected. |