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

CV Calibrate Camera (Chessboard)

Estimates a camera's intrinsics (focal lengths, principal point) and lens distortion from several chessboard views (cv2.calibrateCamera). Calibration needs per-view 2D/3D correspondences accumulated across images, which the raw wrappers can't express, so this node manages it: feed an IMAGE BATCH of board photos from DIFFERENT angles; each is grayscaled, its inner corners are found and refined to sub-pixel (cornerSubPix), and the matching planar object points are built from pattern size x square_size. Views where the board is not found are skipped. Failure-tolerant: with fewer than 3 usable views it returns found=false, an identity matrix and zero distortion. Feed camera_matrix + dist_coeffs into cv2.undistort, or cv2.solvePnP for pose; rms_error (px) reports fit quality (under ~1 is good).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Calibrate Camera (Chessboard)
  • images
  • camera_matrix
  • dist_coeffs
  • rms_error
  • views_used
  • found
pattern_cols9
pattern_rows6
square_size1.00
Categoryimage/CV/features

Inputs (4)

NameTypeDefaultDescription
imagesIMAGEBatch of chessboard views from different angles (>= 3 usable; ~10-20 gives a good fit).
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.

Outputs (5)

NameTypeDescription
camera_matrixNPARRAY3x3 intrinsic matrix K (fx, fy, cx, cy).
dist_coeffsNPARRAYDistortion coefficients (k1, k2, p1, p2, k3).
rms_errorFLOATMean reprojection error in pixels; lower is better (<1 good).
views_usedINTNumber of input views with a detectable board.
foundBOOLEAN