cv2.signal.resampleSignal
Rate-Converting a Signal Inside a ComfyUI Graph
- inputSignal
- nparray
You found a node in the ComfyUI menu called cv2.signal.resampleSignal, you've never seen anyone mention it, and you're wondering whether it's a trap. It isn't - it's a real function out of OpenCV's contrib signal module, exposed by ComfyUI CV (bmad4ever/comfyui_cv) along with ~470 other raw cv2.* wrappers, auto-generated from OpenCV's type stubs.
That auto-generation is the key to understanding this node's oddities. The pack builds each wrapper at import time by inspecting the installed OpenCV, which is why the parameter tooltips on some of these entries are just - - -: the author copy-pasted OpenCV's docstrings where they exist, and where the stub carries no documentation, the tooltip is empty. Nothing was invented to fill the gap. So this node is a straight pass-through to a real OpenCV call, with less hand-holding than the curated nodes get.
What it does
resampleSignal converts a sampled signal from one sampling rate to another - the classic case being inFreq = 48000, outFreq = 44100. It's the signal-processing primitive that belongs in a module alongside dft and the rest of OpenCV's DSP surface - and it's a contrib-module function that a pack pinned to OpenCV 5 can expose and an OpenCV 4 build never would.
In a ComfyUI graph the practical use is narrower than the name suggests. This pack's low-level nodes speak arrays: an IMAGE, a MASK, or an NPARRAY. The useful shapes here are 1-D-ish data - a single scanline or column profile of an image, a measurement series produced by other CV nodes (CV Array To Numbers, CV Numbers To Array, CV Array Statistic, moments, a tracked coordinate across frames) - that you want at a different rate before analysing it. Nothing stops you wiring an image in, since the wrapper hands whatever array it gets straight to cv2, but resampling a picture as though it were a signal generally isn't what you want.
The three inputs and one output
inputSignal- accepts an IMAGE or MASK link directly (frame 0 of a batch) or an NPARRAY. Both image inputs collapse to a single frame, so this node is not a batch operator.inFreq- the rate the input was sampled at, as an integer. Default0.outFreq- the rate you want out, as an integer. Default0.nparray- the resampled signal.
Those 0 defaults deserve a warning. On the scalar parameters of these auto-generated wrappers, the pack's convention is that blank/0 means "whatever OpenCV's default is" - for many functions that's harmless, but a frequency has no meaningful default. Passing 0 in and 0 out is not a sane operation, so type the real rates. If the result looks like garbage or the call raises, this is the first thing to check.
Install
Manager → search ComfyUI CV, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install "opencv-contrib-python-headless~=5.0.0.93"
Restart ComfyUI afterwards; needs Python ≥ 3.12 and a recent ComfyUI on the V3 node API.
Because this one comes from a contrib submodule, the wheel matters more than usual here - see below.
Where people get burned
The node may not exist at all, and that's not a bug. Contrib submodule nodes are probed against your installed OpenCV and skipped when the function is absent. The stub packages ship in every wheel even when the binary can't provide the function, so cv2.signal can be importable-but-empty. Run tools/repair_opencv_contrib.py --check - and note the failure mode that causes it: installing a non-contrib opencv-python over the contrib wheel overwrites the one shared site-packages/cv2, silently gutting every contrib node.
Version pinning. Behaviour is curated against opencv-contrib-python-headless~=5.0.0.93; other versions may behave differently, and a recently-added contrib module is exactly the kind of thing that moves between releases. If signal misbehaves, paste your cv2.__version__ before anything else.
Nobody has a workflow for this. No shipped example uses it, and the README is upfront that the pack is a personal, AI-assisted project where some entries exist because a generator walked the type stubs rather than because the author needed them. That's not a reason to avoid it - it's a reason to test on a signal whose answer you already know before wiring it into anything that matters.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| inputSignal | NPARRAY,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. | |
| inFreq | INT | 0-2147483648–2147483647 | - - - |
| outFreq | INT | 0-2147483648–2147483647 | - - - |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |