OpenCV checkChessboard_0
Is it a chessboard? The gatekeeper of camera-calibration frame selection
- img
- bool
checkChessboard answers one question: does this image contain a recognizable chessboard pattern of a given grid size? It returns a plain boolean. It's a gatekeeper node from the camera-calibration world - the kind of thing you put in front of a findChessboardCorners step so you only run the expensive corner-finding on frames that actually contain the pattern.
If you're calibrating a camera with ComfyUI (a real but niche use - think matching a virtual lens to a real one, or building a 3D-reconstruction pipeline), this is how you filter a batch of calibration photos: run checkChessboard on each frame, keep only the True ones, and feed those to the corner detector. Outside of camera work it has no real job, and that's fine - it's here because the pack wraps every top-level cv2 function, not because you need all of them.
How it works. Under the hood it's OpenCV's heuristic chessboard detector: it looks for the distinctive alternating-corner structure of a checkerboard and checks whether the whole grid resolves cleanly. It's deliberately cheap - the whole point is to reject bad frames before the heavier corner-finding runs. Note that this is actually an ximgproc function (extended image processing, part of the contrib build of OpenCV) - that's why the pack's install needs opencv-python-contrib and not the plain opencv-python.
Inputs and output. Two inputs: img (NPARRAY, the frame to test) and size (STRING, the grid size as a Python literal - (9, 6) for a 9x6 pattern, counting inner corners). Output is a single bool. The literal parsing matters: the node evaluates size with literal_eval, so (9, 6) works and "9x6" throws the pack's standard invalid syntax (unknown, line 0) error.
The ximgproc gotcha. Because this is a contrib-module function, you can hit the README's known dependency conflict: Cannot import name 'guidedFilter' from 'cv2.ximgproc'. That usually means you have conflicting OpenCV packages installed (two different opencv wheels fighting each other). The README points at a known solution thread; the practical fix is to make sure only one OpenCV package (the contrib one) is installed in your environment, not several.
Install. ComfyUI Manager → search "OpenCV", or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib
Restart after. No model files. And yes, checkChessboard_1 is the identical twin of this node - the pack numbers overloads and duplicates MatLike/UMat variants. Use either. Expect dragons, as the author would say.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| img | NPARRAY | — | |
| size | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| bool | BOOLEAN | — |