Nodes/opencv-comfyui/OpenCV mulSpectrums_1
ComfyUI Node

OpenCV mulSpectrums_1

MulSpectrums_1 — frequency-domain multiply, the duplicate edition

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV mulSpectrums_1
  • a
  • b
  • c
  • nparray
flags
conjB

mulSpectrums_1 is the twin of mulSpectrums_0: same a/b spectra inputs, same flags and conjB controls, same nparray output, same cv2.mulSpectrums call. The _0 article has the full guide - here's the short version and the twin story.

What it is

Element-wise multiplication of two Fourier spectra. Multiply then inverse-transform (idft_0) and you've done fast convolution or correlation without sliding any kernel. conjB=True conjugates the second spectrum, switching from convolution to correlation - that's how phase-correlation template matching works. It's a legitimate, powerful primitive that most ComfyUI users will never need.

Inputs in one breath

  • a, b - floating-point DFT spectra (CV_32F/CV_64F), not uint8 images. Feed it dft_0 output or you'll get type errors.
  • flags - 0, or 1 (DFT_ROWS) to process rows independently.
  • conjB - conjugate b first (correlation vs convolution).
  • c (optional) - the out-parameter; skip it.

Output is a spectrum, so it routes into idft_0 or another frequency-domain node - never into a viewer.

Why there are two

The pack's generator emits one node per OpenCV overload in the type stubs - MatLike and UMat - and then maps both to the same NPARRAY type. Result: mulSpectrums_0 and mulSpectrums_1 are functionally identical. Same for minMaxLoc, moments, multiply, normalize and a dozen others in geroldmeisinger/opencv-comfyui. Pick _0 and move on.

Should you use it?

Only if you already know you're doing frequency-domain filtering. If you're not, this is the pack's deepest rabbit hole: complex spectra, corner-located DC component, magnitude vs phase confusion, and constant CV_32FC1 vs CV_8UC1 fights. For almost every real filtering job, spatial-domain nodes (filter2D, GaussianBlur, normalize_0 + multiply_0) are simpler and just as fast for the sizes you're working with.

Install

Manager → "opencv-comfyui", or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

restart. Dependency: opencv-contrib-python.

Troubleshooting

  • Type errors - feed DFT output, not images.
  • "Output is noise" - it's a spectrum, that's expected; inverse-transform before judging.
  • Same inputs as _0? Yes - that's the point. Use _0.
Categoryimage/OpenCV

Inputs (5)

NameTypeDefaultDescription
aNPARRAY
bNPARRAY
flagsINT
conjBBOOLEAN
coptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY