Nodes/ComfyUI CV/cv2.intensity_transform.BIMEF
ComfyUI Node

cv2.intensity_transform.BIMEF

The exposure fixer that raises an error on a stock install

By bmad4ever·Created 4 months ago·Updated 14 days ago· 1
cv2.intensity_transform.BIMEF
  • input
  • nparray
◄mu0.5000►
◄a-0.3293►
◄b1.1258►

Here's the unfortunate headline, from the node's own description in the pack: this one doesn't work on a stock install. Every call raises OpenCV error (-213), because the function needs an OpenCV build compiled with the Eigen library, and the wheels everyone installs report Eigen: NO. If you came here because the node appeared in your menu and then failed, you're not doing anything wrong - there is no graph that fixes it short of building OpenCV yourself.

That makes this short. But it's worth two minutes, because the reason is a generalisable lesson about packs like this one, and because there's a decent chance you actually wanted something else.

What it would do

BIMEF is a single-image exposure enhancement from the intensity_transform contrib module: it estimates a camera response curve and uses it to brighten the underexposed parts of one frame, then blends the brightened version in at a ratio you control. Parameters, all of them preset to OpenCV's defaults:

  • mu (0.5) - the enhancement ratio, i.e. how much of the brightened exposure is mixed back in.
  • a (-0.3293) and b (1.1258) - parameters of the camera response model.

Input is input (IMAGE, MASK or NPARRAY); the output is nparray. Note that unlike its siblings in this module (gammaCorrection, logTransform, autoscaling, contrastStretching), BIMEF does not echo the input format - you get an NPARRAY back, so if this ever ran you'd bridge it with CV Array → Image before an image consumer.

The promise was always appealing: a learned-looking, locally adaptive exposure lift without a model. That's also why it's absent from most builds - Eigen isn't a default dependency of the wheels.

The lesson: a node in the menu isn't a function in your build

The pack's README is unusually candid about this. Its low-level registry is generated from whatever the installed OpenCV exposes, which "can include entries whose implementation the build lacks". Their own worked example is ximgproc.fastBilateralSolverFilter, which appears and then always raises (-213) needs to be compiled with EIGEN when executed. BIMEF and BIMEF2 are the same story in a different module.

So the practical debugging rule, for this pack and for OpenCV-adjacent nodes generally: read the error before you read your graph. If a node exists but every execution throws an OpenCV -213 about a missing library, the problem is the binary, not the wiring.

What to use instead

If you wanted a stronger automatic exposure lift:

  • cv2.intensity_transform.gammaCorrection - a power curve with a control. Below 1 brightens midtones without clipping; that's the ordinary every-day answer.
  • cv2.intensity_transform.logTransform - fixed, parameterless, and much more aggressive about shadows. Try it when the frame is genuinely underexposed.
  • cv2.intensity_transform.autoscaling - global min/max stretch, no curve at all. Good for hazy or flat captures, provided no outlier pixel owns the range.
  • The pack's HDR nodes - CV HDR Exposure Fusion (Mertens), CV HDR Merge to Radiance, CV HDR Tonemap - if you actually have bracketed exposures, which is the honest way to solve "this scene has more dynamic range than my capture".
  • A generative pass if the detail is genuinely gone. That's a different budget and a different risk profile, and it's the only option that invents information.

Don't hunt for NONFREE either, while you're here: the README points out stock wheels are built with OPENCV_ENABLE_NONFREE=OFF, and no shipped workflow uses those functions.

Installing the pack (so the rest of it works)

Manager → search comfyui_cv, or:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install "opencv-contrib-python-headless~=5.0.0.93"

Python ≥ 3.12 and a ComfyUI recent enough for the V3 node API. That install gets you the rest of the intensity_transform family, img_hash and the contrib modules in general. It does not get you BIMEF - that needs a custom OpenCV build with Eigen enabled, which is a "compile it yourself" job rather than a pip flag.

And as ever with this pack: a personal, heavily LLM-assisted project, with the README advising against production use without your own review. A node that always raises is at least honest about it.

Categoryimage/CV/low-level/intensity_transform

Inputs (4)

NameTypeDefaultDescription
inputNPARRAY,IMAGE,MASK - - - 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.
muoptFLOAT0.5000-1e+38–1e+38 - - - Preset to the OpenCV default (0.5).
aoptFLOAT-0.3293-1e+38–1e+38 - - - Preset to the OpenCV default (-0.3293).
boptFLOAT1.1258-1e+38–1e+38 - - - Preset to the OpenCV default (1.1258).

Outputs (1)

NameTypeDescription
nparrayNPARRAY—