OpenCV stereoRectifyUncalibrated_0
Stereo rectification without calibration — just feature matches
- points1
- points2
- F
- H1
- H2
- bool
- nparray_1
- nparray_2
The "Uncalibrated" in the name is the whole pitch: this is stereo rectification for people who don't have a calibration rig, a checkerboard, or any camera intrinsics. Give stereoRectifyUncalibrated two sets of corresponding points and a fundamental matrix, and it computes the two homographies that rectify the pair - making the epipolar lines horizontal so stereo matching becomes a scanline problem. It's the shortcut, and like most shortcuts it has a caveat: the rectification is only up to a projective ambiguity, so depth computed from the result is approximate unless you then calibrate. For eyeballing a stereo pair, aligning two webcams, or getting a rough disparity before committing to a real calibration, it's perfect. For metrology, it isn't.
In ComfyUI terms, this is a deep camera-vision node sitting in a pack that otherwise gets used for blurs and filters. The realistic workflow: load two frames of the same scene, detect and match feature points (SIFT/ORB-style correspondences - the pack's findFundamentalMat_0 gives you the F matrix), feed points1, points2, and F in, and pull out H1/H2. Those homographies then get applied to the two images with warpPerspective_0 (also in this pack) so the pair lines up horizontally, and you can run stereo block matching on the rectified pair.
Inputs and output:
points1/points2- NPARRAY, N×2 matched points from each view.F- NPARRAY, the 3×3 fundamental matrix.imgSize- STRING literal, e.g.(640, 480).threshold- FLOAT, the inlier/rejection threshold (default in OpenCV is 5.0; bigger accepts more slop).
Outputs are a BOOLEAN (bool - whether the computation converged / succeeded), then nparray_1 = H1 and nparray_2 = H2, the two 3×3 homographies. If bool comes back false, your points or F are bad - don't feed the homographies downstream anyway.
The traps. imgSize is a STRING - type (640, 480), and malformed literals throw invalid syntax (<unknown>, line 0). points1/points2 need to be float32 N×2 numpy arrays; ComfyUI IMAGE tensors won't work, and this pack's NPARRAY contract (BGR, uint8) doesn't magically apply to point arrays - you're hand-rolling those in numpy. And stereoRectifyUncalibrated_1 is the identical twin of this node, so don't hunt for a difference.
Install. ComfyUI Manager → search "opencv-comfyui", or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
restart. Needs opencv-contrib-python, numpy, torch; the Cannot import name 'guidedFilter' from 'cv2.ximgproc' startup error means conflicting OpenCV installs and must be fixed first. This is auto-generated, raw camera math in a node - the author's "Expect dragons!" warning applies loudly here.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| points1 | NPARRAY | — | |
| points2 | NPARRAY | — | |
| F | NPARRAY | — | |
| imgSize | STRING | — | |
| threshold | FLOAT | — | |
| H1opt | NPARRAY | — | |
| H2opt | NPARRAY | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| bool | BOOLEAN | — |
| nparray_1 | NPARRAY | — |
| nparray_2 | NPARRAY | — |