Nodes/opencv-comfyui/OpenCV bilateralFilter_1
ComfyUI Node

OpenCV bilateralFilter_1

BilateralFilter_1 — the identical twin of the edge-preserving blur

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV bilateralFilter_1
  • src
  • dst
  • nparray
d
sigmaColor
sigmaSpace
borderType

bilateralFilter_1 is bilateralFilter_0 with a different number. OpenCV's stubs declare cv2.bilateralFilter twice (MatLike and UMat overloads), this pack auto-generates one wrapper per overload, and the result is two identical nodes. Same filter, same inputs, same output. Pick one and ignore the other.

Since you're here, though, it's worth knowing what the filter is for, because it's genuinely one of the pack's more useful entries. It's an edge-preserving blur: it smooths flat regions (skin, sky, gradient areas) but respects strong edges, so you can denoise or soften without turning the image to mush. A Gaussian can't do that - it smears everything, edges included. The KB's post-processing doc's rule of thumb: "soften without losing edges (skin, denoise)? Bilateral or guided filter, not Gaussian."

The inputs

  • src - the NPARRAY to filter.
  • d - neighborhood diameter, odd, typically 5–15; 0 lets OpenCV derive it from sigmaSpace.
  • sigmaColor - color-difference threshold for "same region." Higher = more smoothing across color edges. Start 50–80.
  • sigmaSpace - spatial reach of the blur.
  • borderType - edge-handling constant (4 = BORDER_DEFAULT is fine).
  • dst (optional) - out-parameter, leave unwired.
  • Output: one nparray.

The tuning trap

d is where people go wrong - both ways. Crank it too high and the filter gets slow (bilateral is far heavier than a Gaussian) and the image goes plasticky. Leave it too low and nothing happens. Keep d modest for portraits and let sigmaColor do the work. If the result looks painted, sigmaColor is too high.

Plumbing and install

Everything in this pack speaks NPARRAY: in via Image2Nparray, out via Nparrays2Image, BGR throughout. Install opencv-comfyui via ComfyUI Manager (search "opencv-comfyui") or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib

Restart, no models to fetch. The pack's one known install trap: conflicting OpenCV installs producing Cannot import name 'guidedFilter' from 'cv2.ximgproc' - reinstall cleanly. The _0/_1 duplication is just how this pack handles overloads, so don't hunt for a difference between them.

Categoryimage/OpenCV

Inputs (6)

NameTypeDefaultDescription
srcNPARRAY
dINT
sigmaColorFLOAT
sigmaSpaceFLOAT
borderTypeINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY