Nodes/opencv-comfyui/OpenCV accumulate_1
ComfyUI Node

OpenCV accumulate_1

OpenCV accumulate_1

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

Quick answer before anything else: accumulate_1 is the same node as accumulate_0. Same inputs - src, dst, optional mask - same behavior, same output. The _1 is just the second overload of cv2.accumulate that opencv-comfyui parsed out of OpenCV's type definitions, and the two overloads ended up with identical signatures. You can pick either; nothing changes except which entry you see in the node menu.

What it actually does

It's a running sum over images: dst = dst + src. Feed frames in one at a time and the dst accumulator keeps adding them, without saturating, in floating point. That's the machinery behind temporal averaging (sum all frames, divide by count), long-exposure-style ghosting, and cumulative statistics over a sequence. Since it doesn't clip like add_0 does, the accumulator can grow as large as your sequence demands - which is exactly what you want when the goal is an average rather than a blend.

The inputs that matter

  • src (NPARRAY) - the frame to fold in.
  • dst (NPARRAY, required) - the accumulator. Must be floating point (float32/float64) and the same size as src. A uint8 Image2Nparray output will trip OpenCV's dst.type() == CV_32F assertion immediately.
  • mask (NPARRAY, optional) - only the pixels where the mask is nonzero get added.

Output is a single nparray - the running total.

Honest positioning

This is one of the pack's more awkward nodes for a stock ComfyUI graph, because a useful accumulator needs a loop and a zeros-initialized float array to start from, and the pack doesn't ship a "create float array" convenience node. If you're inside a custom looping workflow, it's genuinely handy for frame statistics. If you're not, you'll fight the plumbing more than the math. The README's own framing - auto-generated, "ugly and complex to use", "expect dragons" - applies here more than most.

Installing opencv-comfyui

ComfyUI Manager → search "opencv-comfyui", or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

Restart, and make sure OpenCV is present:

pip install opencv-contrib-python

Gotchas

  • Float-only accumulator - dst must be float32; uint8 inputs assert.
  • Batch_size == 1 - the conversion nodes refuse batches; slice video with ImageFromBatch.
  • Same size required - src and dst must match dimensions and channels.
Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
srcNPARRAY
dstNPARRAY
maskoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY