Nodes/opencv-comfyui/OpenCV stereoRectifyUncalibrated_1
ComfyUI Node

OpenCV stereoRectifyUncalibrated_1

The other uncalibrated rectifier — it's the same homography math

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV stereoRectifyUncalibrated_1
  • points1
  • points2
  • F
  • H1
  • H2
  • bool
  • nparray_1
  • nparray_2
imgSize
threshold

Before anything else: stereoRectifyUncalibrated_1 is stereoRectifyUncalibrated_0 with a different suffix. The generated source is identical - same inputs, same cv2.stereoRectifyUncalibrated call, same outputs. This pack builds one node per OpenCV overload and ships the duplicates, so you get twins. Pick either and move on; the interesting part is what the function does.

It computes the rectification homographies for a stereo pair without needing camera calibration. You hand it matched points from the two views plus the fundamental matrix between them, and it returns H1/H2 - two 3×3 homographies that, when applied to the respective images, line up corresponding features on horizontal scanlines. That's the precondition for cheap stereo matching, and it's the right tool when you have two roughly-placed cameras and no checkerboard ceremony. The trade: uncalibrated rectification is only correct up to a projective transformation, so depth from the result is approximate. Fine for aligning a webcam pair or eyeballing disparity; not for measurement.

Inputs and outputs:

  • points1 / points2 - NPARRAY, N×2 matched correspondences.
  • F - NPARRAY, 3×3 fundamental matrix (this pack's findFundamentalMat_0 is how you'd get one).
  • imgSize - STRING literal like (640, 480).
  • threshold - FLOAT; OpenCV's default is 5.0.

Outputs: a BOOLEAN success flag (bool), then nparray_1 = H1 and nparray_2 = H2. Check the flag before trusting the homographies - a false means your points or F are garbage. Feed H1/H2 into warpPerspective_0 (also in this pack) to actually rectify the images.

The traps are the usual ones for this pack. imgSize must be a valid Python literal string or you get invalid syntax (<unknown>, line 0). The point arrays are hand-built numpy float32 N×2 arrays, not images, and definitely not ComfyUI tensors. And everything here is raw, auto-generated OpenCV - the author's README literally warns "Expect dragons!". This node is honest camera math; it doesn't care that it lives inside a diffusion tool.

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. If startup throws Cannot import name 'guidedFilter' from 'cv2.ximgproc', you have conflicting OpenCV packages and need to fix that before any node here runs.

Categoryimage/OpenCV

Inputs (7)

NameTypeDefaultDescription
points1NPARRAY
points2NPARRAY
FNPARRAY
imgSizeSTRING
thresholdFLOAT
H1optNPARRAY
H2optNPARRAY

Outputs (3)

NameTypeDescription
boolBOOLEAN
nparray_1NPARRAY
nparray_2NPARRAY