Nodes/comfyui_cv/CV Stereo Rectify (Uncalibrated)
ComfyUI Node

CV Stereo Rectify (Uncalibrated)

Computes the two rectifying homographies for an UNCALIBRATED stereo pair (cv2.stereoRectifyUncalibrated) from matched points and the fundamental matrix - no intrinsics needed. Apply H1 to the left image and H2 to the right (cv2.warpPerspective, borderMode=BORDER_CONSTANT) and the two views become row-aligned: a scene point lands on the SAME image row in both, so 'CV Stereo Disparity (SGBM)' can match along horizontal scanlines. Feed the RANSAC inliers (filter points_a/points_b with 'OpenCV Filter Points By Mask' on the fundamental matrix's inlier_mask) for a stable result. Failure-tolerant: with fewer than 8 points, a degenerate configuration or a not-found (all-zero) fundamental matrix it returns found=false and two IDENTITY homographies (warping leaves the images unchanged) instead of raising - branch on 'found' with a control-flow node.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Stereo Rectify (Uncalibrated)
  • points_a
  • points_b
  • fundamental
  • image
  • H1
  • H2
  • found
threshold5.0
Categoryimage/CV/features

Inputs (5)

NameTypeDefaultDescription
points_aNPARRAYMatched points in the left image, Nx1x2 (inliers from 'CV Filter Points By Mask').
points_bNPARRAYCorresponding points in the right image, Nx1x2.
fundamentalNPARRAY3x3 fundamental matrix from 'CV Find Fundamental Matrix' (all zeros -> found=false here).
imageNPARRAY,IMAGE,MASKEither rectified-pair frame; only its width/height are read (the rectification image size). Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
thresholdoptFLOAT5.00–100Points farther than this (px) from their epipolar line are dropped before solving. 0 keeps all points.

Outputs (3)

NameTypeDescription
H1NPARRAY3x3 float64 homography for the LEFT image (identity if not found).
H2NPARRAY3x3 float64 homography for the RIGHT image (identity if not found).
foundBOOLEAN