OpenCV completeSymm_0
The OpenCV node that isn't about images at all (completeSymm_0)
- m
- nparray
Every pack has that one node that makes you stop and say "wait, that's not an image thing." In opencv-comfyui, this is a strong candidate. completeSymm_0 doesn't process pictures, apply filters, or make anything prettier. It's a linear-algebra utility: it takes a square matrix and makes it symmetric by copying one triangle over to the other. That's the entire job.
What it actually does
OpenCV's cv2.completeSymm(m, lowerToUpper) works in place. A symmetric matrix satisfies m[i][j] == m[j][i] - think covariance matrices, correlation matrices, Gram matrices, pairwise distance/similarity tables. Those are supposed to be symmetric, but the math that builds them often isn't exactly, thanks to floating-point rounding. This function forces the issue:
lowerToUpper = true→ copy the lower triangle into the upper triangle.lowerToUpper = false→ copy the upper triangle into the lower.
The return value is the same (now symmetric) matrix, since it mutates the input and hands it back - the node faithfully forwards C++ call-by-reference behavior that ComfyUI itself would never model this way.
The inputs and outputs
- m (NPARRAY) - a square matrix. If it isn't square, OpenCV throws
(-215:Assertion failed) m.rows == m.colsand you'll be staring at a red node. - lowerToUpper (BOOLEAN) - which triangle wins.
trueis the usual choice if you're normalizing a lower-triangular computation. - Output:
nparray- the symmetrized matrix. Because it's in-place, the output is the input with one half overwritten.
When would you ever use this in ComfyUI
Honestly? Rarely, and the pack author knows it - these nodes were generated wholesale, not curated. The realistic case: you're computing a Gram matrix or covariance from image features (style-transfer-adjacent math, similarity matrices for clustering a batch of renders), and you want the downstream math to see a proper symmetric matrix so eigendecompositions or distance computations don't wobble. It's also just a decent illustration of what "in-place" means when OpenCV semantics get shoved into a graph.
One caution: because it mutates the input, don't rely on the input staying pristine if you reuse it elsewhere in the same run. ComfyUI gives each node fresh values per execution, so in practice this bites less than it would in a Python script - but it's the kind of behavior worth knowing about before you build something on it.
Install and gotchas
Standard pack install: ComfyUI Manager (search "opencv-comfyui") or
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
It needs opencv-python-contrib (requirements.txt: opencv-contrib-python, numpy, torch). The only real failure modes are a non-square input (assertion) and trying to preview the output as an image - a symmetric float matrix is not a picture, and Nparrays2Image will not enjoy it. Feed it true for lowerToUpper, keep your matrix square, and this node does exactly one boring, correct thing.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| m | NPARRAY | — | |
| lowerToUpper | BOOLEAN | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |