Nodes/ComfyUI CV/cv2.findChessboardCornersSBWithMeta
ComfyUI Node

cv2.findChessboardCornersSBWithMeta

Cv2.findChessboardCornersSBWithMeta

By bmad4ever·Created 3 months ago·Updated 14 days ago· 1
cv2.findChessboardCornersSBWithMeta
  • image
  • patternSize
  • retval
  • corners
  • meta
◄flagsnone (0)►

This is cv2.findChessboardCornersSB with a receipt attached. Same sector-based detector, same flags, same corners - plus cv2's own metadata array describing what it found. Most of the time you won't wire that third output anywhere. The time you will is when the detector returns something other than what you asked for and you need to know why.

Inputs

image is the board view; IMAGE, MASK or NPARRAY, converted to uint8 BGR frame 0 for you. patternSize is the inner-corner grid, (points per row, points per column) - squares minus one per axis - as a two-component Size value you type in or wire from CV Tuple.

flags is required here rather than optional (that's how the Python stub declares this overload), and the dropdown carries the SB flag set: none (0), CALIB_CB_NORMALIZE_IMAGE, CALIB_CB_EXHAUSTIVE, CALIB_CB_ACCURACY, CALIB_CB_LARGER, CALIB_CB_MARKER. Same meanings as on the plain SB node. The default is none (0), so nothing is assumed on your behalf.

Outputs, including the interesting one

retval is the boolean success flag - all corners found and ordered, or nothing. corners is the Nx1x2 sub-pixel corner array, row-major, identical in meaning to what the plain SB node returns.

meta is the extra. OpenCV's SB detector keeps per-corner internal information while it searches, and this overload surfaces it as a parallel array - one row per detected corner. It's the detector's own feedback about the pattern, and it's what you read when CALIB_CB_LARGER is involved: with LARGER enabled, the detector is allowed to report a pattern bigger than patternSize, which means the corner count is no longer guaranteed to equal cols × rows. That's the situation this node exists for. You can inspect the shape and contents with the pack's Inspect CV Data node and decide whether to trust the frame, crop it, or reject the view.

Practical use in a calibration batch: wire retval into a control-flow branch so failed views don't poison the average, and check the corner count against pattern_cols × pattern_rows before anything downstream assumes the grid it expected. If the count is off and you left LARGER off, the frame is junk anyway.

How it relates to its neighbours

Three chessboard nodes in this pack are worth keeping straight:

  • cv2_findChessboardCorners - the classic detector, adaptive thresholding, approximate corners, refined internally.
  • cv2_findChessboardCornersSB - the sector-based detector, sub-pixel corners, no metadata.
  • cv2_findChessboardCornersSBWithMeta - the same detector plus the meta channel.

Pick this one when you'd otherwise be guessing about a large or marker-bearing board, or when you're debugging detection on a set of views and want to see what the detector thought it saw. For the ordinary "find the board, calibrate the camera" job, the metadata is dead weight and the plain SB node is tidier. And if the goal is the calibration itself, CV Calibrate Camera (Chessboard) handles the whole batch - detection, sub-pixel refinement, skipping unfound views - without you touching a corner array.

Corners from here go wherever corners go: cv2_drawChessboardCorners to eyeball the overlay, CV Grid Points for the matching planar object points, then cv2_solvePnP for pose, or straight into a hand-rolled cv2_calibrateCamera chain.

Install

Ships with the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install "opencv-contrib-python-headless~=5.0.0.93"

ComfyUI Manager: search "ComfyUI CV", install, restart. Python ≥ 3.12, V3-node-API ComfyUI.

Common issues

retval false, every frame. Check patternSize first - inner corners, (columns, rows). Then board margin, glare, and coverage. CALIB_CB_NORMALIZE_IMAGE and CALIB_CB_EXHAUSTIVE are the two flags to try before reshooting.

Corners come back in a count you didn't expect. You have CALIB_CB_LARGER on. That's its documented behaviour; read meta and the corner shape rather than assuming the grid.

cv2 errors mentioning the metadata array. It's an output-side array - you don't feed it anything; if a wire ended up on it, delete the link.

Whole categories of nodes gone from the menu. A non-contrib OpenCV wheel overwrote the contrib one - they share one site-packages/cv2, so the contrib submodules go empty and their nodes disappear. tools/repair_opencv_contrib.py --check then --apply in the pack directory.

Categoryimage/CV/low-level/cv2 F

Inputs (3)

NameTypeDefaultDescription
imageNPARRAY,IMAGE,MASK - - - 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.
patternSizeCV_TUPLE0,0One value with 2 components (w, h) - it travels as a whole, so it cannot arrive half-connected. Wire it from 'CV Tuple' or type the components in place.
flagsSTRINGnone (0) - - - cv2.findChessboardCornersSBWithMeta flags: one of none (0) plus any of CALIB_CB_NORMALIZE_IMAGE, CALIB_CB_EXHAUSTIVE, CALIB_CB_ACCURACY, CALIB_CB_LARGER, CALIB_CB_MARKER, pipe-joined (e.g. "none (0) | CALIB_CB_NORMALIZE_IMAGE"). In the UI this renders as a dropdown with one toggle per flag.

Outputs (3)

NameTypeDescription
retvalBOOLEAN—
cornersNPARRAY—
metaNPARRAY—