Nodes/comfyui_cv/CV Stereo Calibrate (Circle Grid)
ComfyUI Node

CV Stereo Calibrate (Circle Grid)

Estimates the relative pose (R, T) between two cameras - and both sets of intrinsics unless they are pinned - from matched asymmetric circle-grid views (cv2.stereoCalibrate). Feed an IMAGE BATCH of stereo pairs (left and right views of the SAME board poses, same order); each pair is circle-grid detected independently and skipped unless BOTH views find the full grid. The 'asymmetric (staggered)' layout is the default and the point of this node: a symmetric grid looks identical when rotated 180 degrees, so a tilted board seen by two cameras cannot be matched unambiguously - the staggered rows break that ambiguity, which is why asymmetric circle grids are the standard target for stereo rigs. Pre-calibrate each camera with 'Calibrate Camera (Circle Grid)' 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 pairs returns found=false with identity R and zero T. Feed R, T, K, dist into 'cv2.stereoRectify' for rectification.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Stereo Calibrate (Circle Grid)
  • 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_cols4
pattern_rows11
grid_layoutasymmetric (staggered)
square_size1.00
Categoryimage/CV/features

Inputs (10)

NameTypeDefaultDescription
images_leftIMAGEBatch of LEFT circle-grid views (>= 3 usable pairs; ~10-20 gives a good fit). Same order as images_right.
images_rightIMAGEBatch of RIGHT circle-grid views, same order/length as images_left.
pattern_colsINT42–40Circle centers per row (width of the grid).
pattern_rowsINT112–40Circle centers per column (height of the grid).
grid_layoutCOMBOasymmetric (staggered)Grid geometry. Asymmetric staggers each row by half a spacing, which removes the 180-degree rotational ambiguity of symmetric targets - essential for matching a tilted board across two views.
square_sizeoptFLOAT1.000.0001–1000000Physical center-to-center spacing (e.g. mm); sets the world scale. Leave 1.0 for relative calibration.
K_leftoptNPARRAY3x3 intrinsics for the left camera from 'Calibrate Camera (Circle Grid)'. 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 (Circle Grid)'. 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