Nodes/opencv-comfyui/OpenCV filter2D_1
ComfyUI Node

OpenCV filter2D_1

The second overload of the general convolution

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV filter2D_1
  • src
  • kernel
  • dst
  • nparray
ddepth
anchor
delta
borderType

Same deal as every _1 twin in this pack: filter2D_1 is the second auto-generated overload of cv2.filter2D, and in the ComfyUI graph it is indistinguishable from filter2D_0. Identical inputs - src, ddepth, kernel, anchor, delta, borderType, optional dst - identical nparray output, identical convolution underneath. The generator numbered the overloads from OpenCV's type stubs and they happened to land identical schemas. Use whichever one you grab.

So the real content lives on the filter2D_0 page, and it's worth a trip if you're new to the idea. In one breath: this node applies an arbitrary convolution kernel to an image - you supply the kernel as a numpy array, the node slides it over every pixel, and out comes the filtered image. It's the general primitive underneath blur, sharpen, edge detection and emboss; you use it when the named nodes don't ship the exact filter you want. The knobs to actually set: kernel (the recipe - getStructuringElement_0 in the same pack makes standard kernels for you), ddepth (-1 = same as input; go float if a filter looks black or "does nothing"), anchor (literal (-1, -1) = center), and borderType (start at 4, OpenCV's default).

Installing it

One of ~600 nodes in geroldmeisinger/opencv-comfyui - install the pack once. ComfyUI Manager → search opencv-comfyui, or:

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

then restart. It needs opencv-contrib-python, numpy and torch. Watch for the known startup failure Cannot import name 'guidedFilter' from 'cv2.ximgproc' - conflicting OpenCV installs; consolidate to one consistent version.

House rules as always: nparrays in BGR 0–255 (Image2Nparray in, Nparrays2Image out), and batch size 1 only (use ImageFromBatch with length 1 otherwise).

That's the whole story. The _0 page has the working knowledge; this page is the note that says "and there's a twin that's exactly the same, don't waste a decision on it."

Categoryimage/OpenCV

Inputs (7)

NameTypeDefaultDescription
srcNPARRAY
ddepthINT
kernelNPARRAY
anchorSTRING
deltaFLOAT
borderTypeINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY