Nodes/opencv-comfyui/OpenCV integral_1
ComfyUI Node

OpenCV integral_1

Same summed-area table, second overload

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV integral_1
  • src
  • sum
  • nparray
sdepth

Straight to it: OpenCV integral_1 is a byte-for-byte duplicate of OpenCV integral_0. Same cv2.integral call, same src / sdepth inputs, same (H+1, W+1) output. The pack is auto-generated from OpenCV's type-stub files, and integral shows up in those stubs twice - one overload annotated MatLike, one UMat - so the generator emitted two numbered nodes. With real nparrays they're interchangeable. Everything mechanical lives in the integral_0 article; here's the short version plus the practical notes.

What it does

Computes an integral image (summed-area table): a single pass over the source, writing at each (i, j) the sum of every pixel in the top-left rectangle. The output is one row and column larger than the input and holds large sums rather than colors. Its entire purpose is enabling O(1) rectangle sums downstream - adaptive thresholding, box-blur approximations, local-lighting correction. You won't look at the output; you'll feed it to math. In a typical ComfyUI graph you rarely need it directly - adaptiveThreshold_0, blur_0, and threshold_0 in the same pack wrap the results you actually want.

Inputs and outputs

  • src - NPARRAY, your image via Image2Nparray.
  • sdepth - INT, output depth: 4 (CV_32S) for 8-bit sources, 5 (CV_32F) or 6 (CV_64F) when you need float or extra headroom.
  • sum - optional out-parameter; safe to ignore.
  • Output nparray - the integral image.

Installing

One pack, one install, ~635 nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
cd opencv-comfyui
pip install -r requirements.txt

Or search "opencv-comfyui" in ComfyUI Manager. No models, no downloads - requirements.txt is just opencv-contrib-python, numpy, torch.

Gotchas

The integral image is not a viewable image - values blow past 255, and Nparrays2Image divides by 255 without rescaling, so a preview will look like clipped garbage. That's expected; don't treat it as a bug in the node. Keep batch_size == 1, and remember the whole pack speaks BGR. And since this is a pure overload duplicate of integral_0, there's zero advantage to picking one over the other - use whichever a shared workflow references, and don't let the _1 suffix make you think it's the newer or better variant.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
srcNPARRAY
sdepthINT
sumoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY