OpenCV addWeighted_1
OpenCV addWeighted_1
- src1
- src2
- dst
- nparray
addWeighted_1 is the second overload of the blend function, and like every _1 in this pack it's a duplicate: same src1/alpha/src2/beta/gamma/dtype inputs, same dst = alpha*src1 + beta*src2 + gamma math, same single nparray output as addWeighted_0. The generator emitted one node per OpenCV overload and they share a signature. Pick either - your workflow will behave identically.
What it's for
Weighted blending of two aligned images. With alpha + beta = 1 and gamma = 0 it's a crossfade; with alpha and beta above and below 1 it's a contrast-and-mix trick (e.g. alpha = 2, beta = -1, gamma = 0 on an image and itself = a mild unsharp-style edge pop). It's the deterministic, no-model way to combine two renders, fade between frames, or mix an image with a mask. Instant and reproducible - the whole appeal of this layer of the stack.
The inputs that matter
- src1 / src2 (NPARRAY) - the images to blend; same size.
- alpha (FLOAT) - weight of src1.
- beta (FLOAT) - weight of src2.
- gamma (FLOAT) - per-pixel brightness offset; 0 for a plain blend.
- dtype (INT) -
-1= same type as inputs, the default you want. - dst (NPARRAY, optional) - out-parameter; skip it per the README.
Output: one nparray - the blended result.
Choosing between the twins
You don't need to. This is one of several pairs in the pack where the two numbered nodes are functionally interchangeable, so there's no "correct" one to pick. If anything, that's a reminder of the pack's auto-generated nature - 635 nodes generated from type definitions, duplicate overloads and all. The value of addWeighted itself is high; the distinction between _0 and _1 is zero.
Wiring it up
IMAGE → Image2Nparray → addWeighted_1 → Nparrays2Image. Batch_size 1 only, so slice video with ImageFromBatch. Both input images must be the same dimensions.
Installing opencv-comfyui
ComfyUI Manager → search "opencv-comfyui", or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
Restart ComfyUI. Dependency: opencv-contrib-python.
Gotchas
- Same-size inputs required - mismatches assert.
- Watch your weights - alpha + beta > 1 brightens, < 1 darkens.
- Batch_size == 1 - use
ImageFromBatchfor batches.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| src1 | NPARRAY | — | |
| alpha | FLOAT | — | |
| src2 | NPARRAY | — | |
| beta | FLOAT | — | |
| gamma | FLOAT | — | |
| dtype | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |