OpenCV invert_1
The same matrix inverse, minus the confusion
- src
- dst
- float
- nparray
By now the pattern writes itself: OpenCV invert_1 is the duplicate overload of OpenCV invert_0. cv2.invert shows up twice in OpenCV's type stubs, the generator made two numbered nodes, and they're interchangeable. But there's one piece of context I want to hit again, because it's the thing that makes both of these nodes dangerous: invert means matrix inverse, not color inversion. If you want a photo negative, bitwise_not_0 (same pack) is the node. invert_1 will hand you a matrix and a float, and it will not make your image look like film.
What it does
Computes the inverse of a square matrix using the decomposition in flags:
0DECOMP_LU- fast, fails on singular input.1DECOMP_SVD- robust, copes with degenerate matrices.2–4(EIG/CHOLESKY/QR) - special cases.16DECOMP_NORMAL- OR into the above for least-squares solving.
Returns the inverted matrix plus a float whose meaning depends on the flag (determinant for LU, condition ratio for SVD) - your singularity check.
Inputs and outputs
src- NPARRAY, square float matrix.flags- INT, decomposition (0is the sensible default).dst- optional out-parameter, returned on the output.- Outputs:
floatandnparray(the inverse).
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
cd opencv-comfyui
pip install -r requirements.txt
or ComfyUI Manager → "opencv-comfyui". No model downloads; requirements.txt is opencv-contrib-python, numpy, torch.
Gotchas
The _1 suffix really is nothing special - it's not the SVD "advanced" variant and it's not newer; both nodes call the same cv2.invert with the same flags. Feed it a square float matrix, watch the float output for near-zero (singular = no valid inverse), keep batch_size == 1, and reach for bitwise_not_0 whenever you catch yourself wanting inverted colors instead.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| flags | INT | — | |
| dstopt | NPARRAY | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |
| nparray | NPARRAY | — |