Nodes/ComfyUI CV/CV Region Property Flags
ComfyUI Node

CV Region Property Flags

Define the column list once, reuse it everywhere

By bmad4ever·Created 4 months ago·Updated 15 days ago· 1
CV Region Property Flags
    • properties
    • names
    • columns
    ◄propertiescentroid (x, y)►

    This is the pack's answer to a small, annoying problem: CV Region Properties takes its column selection as a string, and if you have four of those nodes in a graph - or a subgraph around one - keeping them in sync by hand is exactly the kind of thing you'll get wrong and then spend an hour debugging through a (N, 7) matrix that should have been (N, 4).

    So this node builds the string. It's a widget-only node with a single properties input that renders in the UI as the position dropdown plus one toggle per property, and one STRING output that carries the pipe-joined selection. Wire it into the properties input of any number of Region Properties nodes and there's one place to change it.

    Why it's a separate node at all

    Two reasons, and the second is the one that makes it necessary rather than nice.

    Consistency. Same selection, several consumers - feature extraction, a debug copy, a subgraph - and no chance of drift.

    Subgraphs can't carry this widget. If you collapse a Region Properties node into a subgraph, the promoted properties input is a bare socket with no widget of its own. There's nothing to click, which is fine when you're feeding it from this node and impossible when you aren't. That's the actual design driver: this node is how a subgraph author exposes a column selection without reimplementing the widget.

    Outputs

    properties is the string itself - the thing you wire into Region Properties.

    names expands that selection into the column names the resulting matrix will have, comma separated and in emission order. Wire it into Preview as Text and you can read your own schema without running a single mask through anything. This is the output that saves you from the "wait, Hu moments is seven columns?" moment, because you can see hu1, hu2, … hu7 listed before you commit.

    columns is D, the width of the feature matrix - the number of names, not the number of boxes ticked. Those differ whenever a toggle emits more than one column, and they differ by a lot once Hu moments (seven) or mean colour (three) are involved. If you're sizing something downstream off the tick count, this output is the correction.

    The semantics are exactly Region Properties': the position choice is exclusive, everything else is an independent toggle, and the string value looks like no position | area or no position | hu moments (log magnitude). Setting the position to no position is how you cluster regions by size or shape alone rather than by where they happen to sit in frame - which is the difference between "these two blobs are the same kind of thing" and "these two blobs are in the same place".

    Install

    Ships in ComfyUI CV (bmad4ever/comfyui_cv), GPL-3.0 fork of opencv-comfyui:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmad4ever/comfyui_cv
    pip install "opencv-contrib-python-headless~=5.0.0.93"
    # restart ComfyUI
    

    Manager users: search the pack title. Python ≥ 3.12 and a ComfyUI on the V3 node API - the pack is rewritten on V3, so an older ComfyUI shows you nothing at all rather than showing you a broken node.

    The honest verdict

    This is plumbing, and the pack's own docs tag it TB (type bridge) rather than pretending otherwise. It does no image processing, it has no mask input, and on its own it produces nothing but a string. Given one Region Properties node and one column set you'll never need it.

    It earns its place the moment you have two, or a subgraph, or a colleague who has to change the columns without reading your graph. That's also the reason its names and columns outputs exist: they let the graph describe its own schema, which is the difference between a workflow someone can modify and one they can only run.

    One practical note - because these strings travel in workflow JSON, they're also the thing that doesn't break when you copy a graph between machines. CV Region Properties re-derives its columns from the string at execution time, so a selection authored here survives a share, a subgraph collapse, and a ComfyUI update, in a way a widget buried inside a node doesn't always manage. Part of this pack's whole posture is that the data nodes stay data-only and you choose what gets drawn - this node is that principle applied to configuration.

    Categoryimage/CV/contours

    Inputs (1)

    NameTypeDefaultDescription
    propertiesSTRINGcentroid (x, y)Pipe-joined column names, e.g. "no position | area" to cluster by size alone, or "no position | hu moments (log magnitude)" to cluster by SHAPE alone. In the UI this renders as the position dropdown plus one toggle per property, each with its own tooltip.

    Outputs (3)

    NameTypeDescription
    propertiesSTRINGThe pipe-joined selection - wire it into the 'properties' input of an 'CV Region Properties' node or of a subgraph that promotes one.
    namesSTRINGThe column names the selection expands to, comma separated and in emission order (the two orientation pairs, 'centroid offset in bbox' and 'min-area rect centroid clearance' are two columns each, 'mean colour' three, 'hu moments (log magnitude)' seven - hu1..hu7). Wire it into 'Preview as Text'.
    columnsINTD, the width of the feature matrix - the number of names, not the number of boxes ticked.