CV SVD Flags
One Flags Value, However Many SVD Nodes You Wire It To
- flags
- value
CV's flags parameters are bit fields, and bit fields are a bad time in a UI. cv2.SVDecomp wants an OR of three constants; you want to remember which combination you used last time and why. This node is the fix: pick the flags once, wire the output into as many cv2_SVDecomp nodes as you like, and every one of them shares the same configuration.
It's the exact same idea as the pack's other flag builders (CV Threshold Flags, CV Warp Flags, CV Chessboard Flags…). Each is one node with one flags input whose renderer is a base dropdown plus a toggle per bit, so you're choosing names rather than integers.
What it does
The flags input is a pipe-joined string of cv2 constant names, e.g. none (0) | SVD_MODIFY_A. In the UI that renders as a dropdown, not a text field - the widget carries the flag spec. Two outputs, and the difference matters:
flags(STRING) - the pipe-joined names, for wiring into theflagsinput ofcv2_SVDecompnodes. This is the type-safe path: the string is resolved and validated when the node runs, so a typo errors loudly instead of silently OR-ing the wrong bit.value(INT) - the resolved integer, for rawINTflag parameters or aMathExpressionwhere you need the actual number.
The bits themselves, for cv2.SVDecomp:
SVD_MODIFY_A- lets the decomposition overwrite the input matrix rather than leaving it alone. In a graph you never see the difference; it's a memory behaviour, not a result.SVD_NO_UV- skip computing U and V entirely. The cheapest option, and correct whenever you only want the singular values.SVD_FULL_UV- compute full-size U and V rather than the economy versions. Bigger outputs, sometimes what a downstream matrix multiply needs.
Base is none (0), which is the sensible default for "I want the decomposition and nothing clever".
Why you'd want a node for this
Three reasons, and they're all the plumbing-layer reasons: you don't want to remember that the constants OR together, you don't want to re-pick the same flags in five places and get them inconsistent, and you do want one place to change when you decide you only needed singular values after all. Same argument as any value node in ComfyUI - one authoritative source, many consumers.
Beyond that it does nothing. No pixels, no computation beyond an OR.
Install
ComfyUI Manager → search ComfyUI CV (publisher bmad4ever), or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install "opencv-contrib-python-headless~=5.0.0.93"
Restart afterwards. Python ≥ 3.12 and a recent ComfyUI built on the V3 node API. Keep the contrib wheel - a plain opencv-python install shares the same site-packages/cv2 and silently strips the contrib submodules, taking other nodes in this pack with it. tools/repair_opencv_contrib.py --check / --apply exists for that.
Where it bites
If you don't see the dropdown-and-toggles renderer, you're on an older frontend build - the widget rides on a per-node spec the pack ships, and without it you get a text box where you'd be typing constant names by hand.
The other one is subtle: this node has no idea what you're wiring it into. SVD_MODIFY_A is meaningless to a threshold call and THRESH_OTSU is meaningless to a decomposition, and nothing will stop you. The pack has one flag builder per target function family for that reason - use the matching one.
And the pack's own README, for the record: personal project, heavy LLM assistance, curated against a specific OpenCV build, no support planned. A flags OR-er is about as low-risk as nodes get, so this is mostly a note that the rest of the pack deserves more scrutiny than this one.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| flags | STRING | none (0) | Pipe-joined cv2 constant names, e.g. "none (0) | SVD_MODIFY_A". In the UI this renders as a base dropdown with one toggle per flag. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| flags | STRING | The pipe-joined flags string - wire it into the flags input of cv2_SVDecomp nodes. |
| value | INT | The resolved integer (constants OR-ed together). |