OpenCV SVBackSubst_0
SVD back-substitution — linear algebra for the workflow masochist
- w
- u
- vt
- rhs
- dst
- nparray
SVBackSubst_0 solves a linear system, and it expects you to have done your homework. It takes the three SVD factors - w, u, vt, exactly what SVDecomp_0 in this pack produces - plus a right-hand side rhs, and computes the solution x where A·x = rhs. If you've ever seen the formula x = V·inv(W)·Uᵀ·b, that's this node, without the scare quotes: back-substitution using a precomputed singular value decomposition.
Who needs this in ComfyUI? Honestly, a tiny minority - but it's real. If you're doing any matrix math in a workflow - least-squares fitting, computing a pseudo-inverse, solving a system from point correspondences, or post-processing the output of a numeric node - this is the well-conditioned way to do it. SVD-based solving is the numerically stable approach: it handles near-singular matrices far more gracefully than a naive inv(A)·b. If you're reconstructing 3D points from stereo (pair it with the stereoRectify family's Q matrix), fitting transforms, or debugging a matrix you built in numpy, this is the right tool and there's no friendlier equivalent in stock ComfyUI.
Inputs and output:
w- NPARRAY; the singular values (diagonal), as returned bySVDecomp_0's first output.u- NPARRAY; left singular vectors.vt- NPARRAY; right singular vectors, transposed.rhs- NPARRAY; the right-hand sideb(one or several columns).dst- optional out-parameter; the README says to skip these.
Output is a single nparray: the solution vector(s) x. Shapes must be consistent with the SVD of your A matrix or cv2 throws - there's no hand-holding here.
Honest framing. This is a raw cv2 function wrapped with zero polish, in a pack whose author openly tags it "Expect dragons!". The inputs are all NPARRAY hand-built in numpy; nothing here reads ComfyUI tensors. The realistic use is a workflow that already does matrix math in numpy and wants a stable solve step in the graph - if that's not you, SVBackSubst will just be the node that makes you read an SVD tutorial at 1am. It works exactly as documented; it just has no idea it's living inside an image generator.
Install. ComfyUI Manager → search "opencv-comfyui", or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
restart. Requires opencv-contrib-python, numpy, torch; the Cannot import name 'guidedFilter' from 'cv2.ximgproc' startup error means conflicting OpenCV packages and must be fixed first. And SVBackSubst_1 is the identical twin - same factors, same solve, no difference.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| w | NPARRAY | — | |
| u | NPARRAY | — | |
| vt | NPARRAY | — | |
| rhs | NPARRAY | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |