Nodes/opencv-comfyui/OpenCV equalizeHist_1
ComfyUI Node

OpenCV equalizeHist_1

EqualizeHist_1 is the same node as _0 — here's why it exists

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV equalizeHist_1
  • src
  • dst
  • nparray

Let's get the elephant out of the room immediately: equalizeHist_1 does exactly what equalizeHist_0 does. Same inputs, same output, byte-for-byte the same generated code. If you compare them side by side in the pack source, cv2_equalizeHist_1 is a copy-paste of cv2_equalizeHist_0. Pick either one; you cannot tell the difference by using them.

So why do two identical nodes exist? It's an artifact of how this pack is built. opencv-comfyui (geroldmeisinger/opencv-comfyui) parses OpenCV's Python type stubs and generates one node per function overload. Many OpenCV functions are declared multiple times in the stubs with slightly different signatures - same name, different parameters - and the generator numbers them: _0, _1, and so on. When the overloads happen to be near-identical, as with equalizeHist, you get two nodes that look exactly alike. The cv2.equalizeHist overloads differ only in whether dst is present, and the generator collapsed that into the same optional dst input on both.

What it does

Same as _0: histogram equalization for a single-channel 8-bit grayscale image. It spreads a bunched-up histogram across the full gray range, giving flat, washed-out images a cheap "auto contrast" boost. Good for the deterministic post-processing layer - the pixel-work that happens after the sampler, before or instead of sending the image back through a model. No model, no weights, instant.

Inputs and outputs

  • src (NPARRAY) - your image, grayscale only. BGR or RGB in will throw the img.type() == CV_8UC1 assertion.
  • dst (NPARRAY, optional) - OpenCV out-parameter; leave it alone.
  • Output: nparray - the equalized grayscale image.

Wiring it up

Same dance as every node in this pack - it doesn't eat ComfyUI's IMAGE type. Convert with Image2Nparray, then cvtColor code 6 (BGR2GRAY) before this node, then cvtColor code 8 (GRAY2BGR) and Nparrays2Image on the way back out. Yes, it's a lot of plumbing for one operation. That's the price of this pack's design: it mirrors raw OpenCV deliberately, and cvtColor conversions are "intentional" per the README.

Install and gotchas

Install via ComfyUI Manager (search "opencv-comfyui") or git clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes, then restart. Dependencies: opencv-contrib-python, numpy, torch - no model downloads. The author labels the whole pack "Expect dragons!": auto-generated, raw enum numbers, composite parameters typed as Python literals.

The gotchas are shared with _0: grayscale-only input (the -215 error means you skipped cvtColor code 6), and Image2Nparray chokes on batch sizes above 1. If you're new, just use _0 - the page for it has the full walkthrough. Bookmarking this page is still useful: when you see _0/_1 suffixes elsewhere in this pack, you'll know they're overload twins, not a bug in your graph.

Categoryimage/OpenCV

Inputs (2)

NameTypeDefaultDescription
srcNPARRAY
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY