Nodes/opencv-comfyui/OpenCV sepFilter2D_1
ComfyUI Node

OpenCV sepFilter2D_1

SepFilter2D_1 is a duplicate — here's the deal with the _0/_1 numbering

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV sepFilter2D_1
  • src
  • kernelX
  • kernelY
  • dst
  • nparray
ddepth
anchor
delta
borderType

First, the thing you actually came here to learn: sepFilter2D_1 and sepFilter2D_0 are the same node. Identical inputs, identical behavior, both call cv2.sepFilter2D with the same arguments. You can use either and the output is bit-for-bit the same. Pick one, delete the other from your workflow, move on.

So why do two exist? This pack is auto-generated. The author parses OpenCV's Python type-stub files with ast.parse() and emits one ComfyUI node per overload it finds. OpenCV declares most functions with several overloads (one for MatLike, one for UMat, one with the dst parameter, one without, and so on). The generator numbers them _0, _1, _2... and in a lot of cases - sepFilter2D included - the generated nodes for two different overloads end up with the exact same signature and behavior. It's not a bug, it's an artifact of faithful generation. The README warns you these nodes are "ugly and complex to use" precisely because of this.

What the node does, for real: separable 2D convolution. It filters your image with kernelX and kernelY - two 1D kernels applied horizontally then vertically - which is mathematically the same as one 2D kernel but much cheaper for anything larger than 3×3. Gaussian blur is implemented this way internally. If you're reaching for it at all, you almost certainly want one of the more convenient filters this pack ships (GaussianBlur, Sobel), and you go raw only when you have custom 1D kernels.

The inputs that matter:

  • src - NPARRAY, meaning a BGR uint8 array from Image2Nparray.
  • kernelX / kernelY - both NPARRAY. You need to source kernel arrays from another node (the pack's getGaussianKernel_0 works).
  • ddepth - -1 keeps source depth; 5 (CV_32F) for unclamped float output.
  • anchor - a STRING entered as a Python literal, e.g. (-1, -1) for the center. This is the pack's signature quirk: composite types are parsed with literal_eval, so the syntax has to be valid Python.
  • delta, borderType - boring defaults; 0 and 4 respectively.

There's an optional dst NPARRAY input - the OpenCV out-parameter, which you should leave alone. One nparray output feeds into Nparrays2Image.

Install is the same for the whole pack: ComfyUI Manager → search "opencv-comfyui", or git clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes and restart. It needs opencv-contrib-python (plus numpy/torch, which ComfyUI already has) - and if startup dies with Cannot import name 'guidedFilter' from 'cv2.ximgproc', you have two conflicting OpenCV installs and need to uninstall one.

The recurring failure mode here is typing the anchor literal wrong - (-1, -1) works, -1, -1 doesn't, and you get invalid syntax (<unknown>, line 0) from the parser. When that happens, it's not your workflow that's broken, it's the literal-string convention. Add the parentheses and re-run.

Categoryimage/OpenCV

Inputs (8)

NameTypeDefaultDescription
srcNPARRAY
ddepthINT
kernelXNPARRAY
kernelYNPARRAY
anchorSTRING
deltaFLOAT
borderTypeINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY