OpenCV accumulateSquare_1
OpenCV accumulateSquare_1
- src
- dst
- mask
- nparray
Short version: accumulateSquare_1 is a duplicate of accumulateSquare_0. Identical inputs (src, dst, optional mask), identical dst = dst + src² behavior, identical single nparray output. The _1 comes from OpenCV's overload list, and for this function the overloads collapse to the same signature, so opencv-comfyui emitted two interchangeable nodes. Use whichever one you find.
What it does
It squares every pixel of src and adds the result into a floating-point accumulator, growing Σ(src²) across however many frames you feed it. Non-saturating by design - that's the whole point of the accumulate family versus add_0, which clips. Paired with accumulate_0's Σ(src), it's the raw material for frame-sequence variance and standard deviation. On its own it's a statistic you'd combine later, not an effect you'd view.
The inputs that matter
- src (NPARRAY) - the image being squared and folded in.
- dst (NPARRAY, required) - the accumulator. Must be
float32, same size assrc. - mask (NPARRAY, optional) - only accumulate where the mask is nonzero.
Output: one nparray, the updated Σ(src²).
Where it fits
Realistically, in the same narrow slot as all the accumulate nodes: temporal statistics over a frame sequence, inside a workflow that already iterates frames. Stock ComfyUI doesn't loop natively, so this leans toward custom pipelines. The README's honest warning - auto-generated nodes, some not useful inside ComfyUI without extra processing - is the right frame for it. When you need variance over frames, it's exactly the right primitive; until then, it'll just sit in the menu.
Installing opencv-comfyui
ComfyUI Manager → search "opencv-comfyui", or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
Restart ComfyUI. OpenCV (opencv-contrib-python) is the dependency; you almost certainly have it already.
Gotchas
- Float accumulator only -
uint8dsttripsdst.type() == CV_32F. - Batch limit - Image2Nparray only handles
batch_size == 1. - Float output ≠ displayable image - don't feed the accumulator to Nparrays2Image and expect a picture back.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| dst | NPARRAY | — | |
| maskopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |