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

CV Omnidir Calibrate (Chessboard)

Calibrates a catadioptric / >180-degree lens with CMei's omnidirectional model (cv2.omnidir.calibrate). It adds a mirror parameter 'xi' to the usual K and four (k1, k2, p1, p2) coefficients, which is what lets it describe a view wider than any pinhole or fisheye model. Feed a batch of chessboard views; corner detection uses a 7x7 refinement window by default because the usual 11x11 drags corners several pixels on a compressed omnidir view. WATCH THE PARAMETERS, not just the RMS: focal length and xi are strongly correlated, so a fit can reproject at 0.05 px while reporting fx 327 / xi 0.96 for a camera whose truth is 300 / 0.80 - unless the boards cover the periphery, where the two stop being interchangeable. Failure tolerant: fewer than 3 usable views, or a cv2 error, returns found=false.

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

Inputs (6)

NameTypeDefaultDescription
imagesIMAGEBatch of chessboard views from different angles (>= 3 usable). Spread them across the frame: the xi/focal degeneracy is what wide coverage breaks.
pattern_colsINT92–40Inner corners per row (squares per row minus 1).
pattern_rowsINT62–40Inner corners per column (squares per column minus 1).
flagsSTRINGnone (0) | CALIB_FIX_SKEWSolver options, OR-ed. These are the cv2.omnidir constants, NOT the top-level CALIB_* ones of the same name (different values). FIX_SKEW pins alpha to 0; FIX_XI holds the mirror parameter; FIX_CENTER holds the principal point.
square_sizeoptFLOAT1.000.0001–1000000Physical size of one square; sets the world scale.
refine_windowoptINT73–31cornerSubPix search window (full width, odd). 7 by default because at 11 the window spans neighbouring squares where the image is compressed and pulls corners up to 7 px away from where the model says they are - and the calibration RMS goes DOWN when that happens (0.057 against 0.073 px on the shipped boards), because a smooth bias is absorbed by the parameters. Do not tune this by RMS.

Outputs (6)

NameTypeDescription
camera_matrixNPARRAY3x3 intrinsic matrix K.
xiFLOATCMei's mirror parameter. 0 would be a pinhole; the bigger it is, the further past 180 degrees the model reaches.
dist_coeffsNPARRAYFOUR coefficients (k1, k2, p1, p2) as 4x1 - the omnidir set, not the pinhole or fisheye one.
rms_errorFLOATMean reprojection error in pixels. A small value does NOT mean K and xi are individually right.
views_usedINTViews cv2 actually kept (it drops some itself).
foundBOOLEAN