Nodes/ComfyUI CV/cv2.ximgproc.fastBilateralSolverFilter
ComfyUI Node

cv2.ximgproc.fastBilateralSolverFilter

The node that always raises an error, and why

By bmad4ever·Created 3 months ago·Updated 14 days ago· 1
cv2.ximgproc.fastBilateralSolverFilter
  • guide
  • src
  • confidence
  • nparray
◄sigma_spatial8.0000►
◄sigma_luma8.0000►
◄sigma_chroma8.0000►
◄lambda_128.0000►
◄num_iter25►
◄max_tol0.0000►

If you run this node and get an error every single time, that's expected. You're not doing anything wrong. From the pack's README:

"On the pinned reference build, for instance, ximgproc.fastBilateralSolverFilter is exposed but always raises (-213) needs to be compiled with EIGEN when executed; another build could surface more or fewer such entries."

So this is a node that exists in your menu, has a full set of working-looking parameters, and cannot execute on a stock pip install. Annoying - but the pack handles it better than most would. It detects the situation at import time by reading cv2.getBuildInformation() for the Eigen flag, and it prefixed the node's own description with the warning, in capitals, so you see the requirement before you wire anything:

"REQUIRES AN OPENCV BUILT WITH THE EIGEN LIBRARY - NOT AVAILABLE IN THIS BUILD ('Eigen: NO'), SO EVERY CALL RAISES OpenCV ERROR (-213). Install an Eigen-enabled OpenCV build to use it."

You can check your own build the same way: the pack has a CV Build Information node that serves the OpenCV build banner with filesystem paths redacted, so look for the Eigen: line. YES and this node works; NO and it doesn't.

What it would do if it ran

fastBilateralSolverFilter is an implementation of Barron & Poole's fast bilateral solver - the algorithm behind the "DeepLab/Portrait Mode"-era matting refinement tricks. It solves a sparse-to-dense problem properly: you give it a small set of samples with confidence values, plus a guide image, and it fills in the rest of the field aligned to the guide's edges, in one global optimisation rather than a local window.

Its inputs, per the node's schema:

  • guide - "image serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels."
  • src - "source image for filtering with unsigned 8-bit or signed 16-bit or floating-point 32-bit depth and up to 4 channels."
  • confidence - "confidence image with unsigned 8-bit or floating-point 32-bit confidence and 1 channel."
  • sigma_spatial (8), sigma_luma (8), sigma_chroma (8), lambda_ (128), num_iter (25, and the tooltip says 25 "is usually enough"), max_tol (1e-05) - all pre-filled with OpenCV's defaults.

That signature tells you the intended use: a sparse, noisy, partially-confident field in, a dense edge-hugging field out. Refined mattes, refined depth/disparity, upsampled per-pixel scores. It's genuinely one of the nicer algorithms in the module - which is why its absence is worth knowing about rather than discovering at 2am.

Getting a build that runs it

The pip wheels with -headless or not are all built with Eigen disabled - that's an upstream wheel-build decision, not something this pack controls. To use this node you'd need an OpenCV built with Eigen enabled: self-compiled, or a distribution package that happens to include it. The pack's stance is deliberate: the entry stays in the registry because a build that does have Eigen runs it through the same API, and the description tells you which case you're in. It's the honest version of "not supported here".

If you do compile your own OpenCV, note the other half of the install advice in this pack - cv2 lives in one shared site-packages/cv2 directory across all four opencv-python* distributions, so whatever you put there last wins, and losing contrib empties whole submodules without an error. tools/repair_opencv_contrib.py --check in the pack repo diagnoses that state.

What to use instead, today

Everything below is in this same pack and runs on a stock wheel:

  • cv2.ximgproc.guidedFilter - local linear fit to a guide; the general-purpose "edge-aware everything" workhorse.
  • cv2.ximgproc.dtFilter - domain transform; cheap, bilateral-like, no eigen dependency.
  • cv2.ximgproc.jointBilateralFilter / rollingGuidanceFilter / weightedMedianFilter - the rest of the edge-aware shelf.
  • CV Disparity Filter (WLS) - the curated node for the sparse-to-dense disparity case this solver would otherwise handle. If your actual goal was "clean up this depth map using the image as a guide", that's the node you wanted.
  • CV Disparity Interpolate (Edge-Aware) - hole-filling for disparity with locally-affine fitting.

What goes wrong

  • It never runs. That's the whole story on a stock build. Read the node description in the UI; if it starts with "REQUIRES AN OPENCV BUILT WITH THE EIGEN LIBRARY", this is why.
  • You're re-trying the same graph hoping for a different result. The (-213) is deterministic per build. Check CV Build Information once and stop.
  • Assuming other ximgproc nodes have the same problem. They don't - this is an Eigen-gated function specifically. The filters above all run fine on the plain contrib wheel.
Categoryimage/CV/low-level/ximgproc

Inputs (9)

NameTypeDefaultDescription
guideNPARRAY,IMAGE,MASKimage serving as guide for filtering. It should have 8-bit depth and either 1 or 3 channels. 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.
srcNPARRAY,IMAGE,MASKsource image for filtering with unsigned 8-bit or signed 16-bit or floating-point 32-bit depth and up to 4 channels. 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.
confidenceNPARRAY,IMAGE,MASKconfidence image with unsigned 8-bit or floating-point 32-bit confidence and 1 channel. 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.
sigma_spatialoptFLOAT8.0000-1e+38–1e+38parameter, that is similar to spatial space sigma (bandwidth) in bilateralFilter. Preset to the OpenCV default (8.0).
sigma_lumaoptFLOAT8.0000-1e+38–1e+38parameter, that is similar to luma space sigma (bandwidth) in bilateralFilter. Preset to the OpenCV default (8.0).
sigma_chromaoptFLOAT8.0000-1e+38–1e+38parameter, that is similar to chroma space sigma (bandwidth) in bilateralFilter. Preset to the OpenCV default (8.0).
lambda_optFLOAT128.0000-1e+38–1e+38 - - - Preset to the OpenCV default (128.0).
num_iteroptINT25-2147483648–2147483647number of iterations used for solver, 25 is usually enough. Preset to the OpenCV default (25).
max_toloptFLOAT0.0000-1e+38–1e+38convergence tolerance used for solver. For more details about the Fast Bilateral Solver parameters, see the original paper . Preset to the OpenCV default (1e-05).

Outputs (1)

NameTypeDescription
nparrayNPARRAY—