Inspect CV Data
The debugger for a graph that has no printf
- value
- summary
What it's for
A cv2 function returns a tuple and you don't know which element is what. A homography is 3×3, or maybe it's empty, or maybe every value in it is nan. Something downstream says "shape mismatch" and you have no way to ask the graph what shape the thing actually was.
Inspect CV Data is the answer to all three. Wire any output into it and it tells you what's there: shape, dtype, and value statistics. It's the single most valuable node in this pack for a beginner, because the pack is ~470 auto-generated wrappers around OpenCV and the wrappers do not explain themselves.
How it works
The input is the wildcard ANY type, which is why this node is so useful - it accepts anything. An ndarray, a torch tensor, a tuple, a list, a scalar. OpenCV's multi-return functions (the ones that give you back both a result and a mask, or a whole tuple of intermediates) come through the wrapper as tuples, and this recurses into them, indented, showing you each element in turn. That's how you find out that element 0 is your image and element 1 is the mask, instead of guessing and finding out by the shape of the error.
On an array it reports shape and dtype, then value statistics. Two details in that output are worth knowing because they're deliberate:
- Non-finite values are excluded from the stats, and counted. Distance transforms, optical-flow fields and score maps routinely contain
nanandinf, and if they were included,min/max/meanwould come back asnanand tell you nothing. Instead you get real statistics plus a line saying how many values were dropped. That count is a signal, not noise - three thousandnans is a bug upstream, not a formatting quirk. - Boolean arrays report True counts. For a mask or a
visibleflag array you getTrue: 412/512 (80.5%)rather than a min/max of 0 and 1.
The output is summary, a STRING. Wire it into ComfyUI core's Preview as Text (PreviewAny) to actually read it.
Where to put it
Anywhere a wire is giving you trouble. Between a solver and the node that consumes its matrix. On the visible mask of CV Decompose Homography when you want to know how many candidates survived. On a loader's arrays before they enter a chain you didn't write. It's meant to be temporary scaffolding, and it's cheap enough to leave in during development.
The picture-side partner is CV Preview CV Array, which renders an array you can see but can't read numbers off. Together they cover both halves: this one tells you what it is, that one shows you what it looks like.
Install
ComfyUI Manager, search ComfyUI CV, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
Restart. Python ≥ 3.12, a recent ComfyUI (V3 node API), and:
pip install "opencv-contrib-python-headless~=5.0.0.93"
Where people get burned
You wired it and saw nothing. The summary is a string on a wire, not a popup. Connect summary to Preview as Text or you'll be sitting there wondering why a debug node is quiet.
It's an output node, so it always runs. ComfyUI identifies output nodes and works backwards from them, which means an Inspect node keeps its whole branch alive - including the expensive part. As a debugging tool that's exactly what you want. Left wired into a 4K branch in production, it's a quiet performance tax that nobody will find later. Unhook it when you're done.
The wildcard input means no type checking. ComfyUI can't validate a * socket, so you'll never get a red wire for wiring the wrong thing into it. That's the price of a node that accepts everything.
nan reports are worth chasing. If the count line says non-finite values were excluded, look at what produced them. A degenerate matrix from a solver or a nan in a disparity map will travel surprisingly far through this pack before something finally errors, and this is the earliest place you'll see it.
Credit where it's due, and a caveat too. This pack is a GPL-3.0 fork of geroldmeisinger's opencv-comfyui, maintained by bmad4ever as a personal project, and the author is refreshingly blunt that it's LLM-assisted, not production-hardened, and not fully covering OpenCV (class-based APIs and complex multi-return functions are largely absent unless a curated node bridges them). The whole point of a node like this one is that you can check the pack's claims against your own data. Use it that way.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | * | Any value to inspect - ndarray, tensor, tuple/list, scalar. Wire the 'summary' output into core 'Preview as Text' (PreviewAny) to actually display it. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| summary | STRING | — |