Nodes/comfyui_cv/CV Stereo Calibrate (Chessboard)
ComfyUI Node

CV Stereo Calibrate (Chessboard)

Estimates the relative pose (R, T) between two cameras - and both sets of intrinsics unless they are pinned - from matched chessboard views (cv2.stereoCalibrate). Feed an IMAGE BATCH of stereo pairs (left and right views of the SAME board poses, same order); each pair is corner-detected independently and the matching 3-D/2-D correspondences are accumulated. Pre-calibrate each camera individually with 'Calibrate Camera' and feed BOTH K matrices here to PIN the intrinsics (CALIB_FIX_INTRINSIC - only R and T are then estimated, which is the recommended two-stage workflow); with one or neither K connected the intrinsics are estimated/refined here and any K you did pass is only an initial guess. Failure-tolerant: with fewer than 3 usable views returns found=false with identity R and zero T. Feed R, T, K, dist into 'cv2.stereoRectify' for rectification, then 'Stereo Disparity (SGBM)' for depth.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Stereo Calibrate (Chessboard)
  • images_left
  • images_right
  • K_left
  • dist_left
  • K_right
  • dist_right
  • K_left
  • dist_left
  • K_right
  • dist_right
  • R
  • T
  • rms_error
  • found
pattern_cols9
pattern_rows6
square_size1.00
Categoryimage/CV/features

Inputs (9)

NameTypeDefaultDescription
images_leftIMAGEBatch of LEFT chessboard views (>= 3 usable pairs; ~10-20 gives a good fit). Must be in the same order as images_right.
images_rightIMAGEBatch of RIGHT chessboard views, same order/length as images_left.
pattern_colsINT92–40Inner corners per row (squares per row minus 1).
pattern_rowsINT62–40Inner corners per column (squares per column minus 1).
square_sizeoptFLOAT1.000.0001–1000000Physical size of one square (e.g. mm); sets the world scale. Leave 1.0 for relative calibration.
K_leftoptNPARRAY3x3 intrinsics for the left camera from 'Calibrate Camera'. Connect BOTH K_left and K_right to hold the intrinsics FIXED and solve only for R/T; on its own it is just an initial guess and still gets refined. Leave unconnected for a fresh estimate.
dist_leftoptNPARRAYLeft distortion coefficients from 'Calibrate Camera'. Also held fixed when both K matrices are connected.
K_rightoptNPARRAY3x3 intrinsics for the right camera. See K_left: both connected = intrinsics pinned, one alone = initial guess only.
dist_rightoptNPARRAYRight distortion coefficients.

Outputs (8)

NameTypeDescription
K_leftNPARRAYRefined 3x3 intrinsic matrix for the left camera.
dist_leftNPARRAYRefined distortion coefficients for the left camera.
K_rightNPARRAYRefined 3x3 intrinsic matrix for the right camera.
dist_rightNPARRAYRefined distortion coefficients for the right camera.
RNPARRAY3x3 rotation matrix from left to right camera.
TNPARRAY3x1 translation vector from left to right camera.
rms_errorFLOATMean reprojection error in pixels; lower is better.
foundBOOLEAN