OpenCV illuminationChange_1
Same relighting node as _0, because OpenCV listed the overload twice
- src
- mask
- dst
- nparray
The short version: illuminationChange_1 and illuminationChange_0 are the same node. This pack auto-generates a ComfyUI wrapper for every top-level OpenCV function by parsing the cv2 type stubs, and it numbers overloads _0, _1, etc. In some cases those overloads are genuinely different signatures; in this case the two generated classes are identical - both call cv2.illuminationChange(src, mask, dst, alpha, beta) with the same parameter order. Use either. There's no hidden difference, no bug in one of them, nothing.
So what does the function actually do? cv2.illuminationChange relights a masked region as if the illumination differed - it fits a local photometric model of the masked area and re-renders it under different lighting, rather than just brightening it with a slider. It's the kind of operation you use for synthesizing training data: one source image, and you generate variants where a local region sits under different light, so a model you're fine-tuning learns to be lighting-robust. It is not a creative filter you'd slap on a final render; a gamma curve or exposure node is the right tool for "make this area brighter."
Inputs. src (NPARRAY) and mask (NPARRAY) - image and the region to relight, both as numpy arrays in the pack's BGR uint8 form (convert with Image2Nparray). Then the two floats that do the work:
alpha(FLOAT) - strength of the lighting change in the masked area.beta(FLOAT) - the second influence weight; OpenCV's own examples use 0.2 and 0.4.
Both behave in the subtle-to-weird range and resist intuition, so change one at a time and look at the result. dst is the optional out-parameter - leave it unwired.
Output. One nparray (NPARRAY): the relit image. Back into ComfyUI-land with Nparrays2Image.
Installing. Standard for this pack - ComfyUI Manager, search "opencv-comfyui", or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib
Restart ComfyUI. Node lives under image/OpenCV.
Where people get burned. The mask must be an NPARRAY, not a ComfyUI MASK tensor - convert it. src needs to be a real color NPARRAY or OpenCV will assert on type/channel mismatch (img.type() == CV_8UC1-style errors; the README's answer is to convert channels with cvtColor, 6 = BGR2GRAY, 8 = GRAY2BGR). And the pack's universal constraint: batch size 1, or you get the Only images with batch_size==1 are supported! error - use ImageFromBatch at length=1.
One more expectation to set: this is an auto-generated pack, the author's own words are "Expect dragons!", and the knobs are raw numbers with no tooltips. If you're here for a one-off relight, a simpler post-processing pack will serve you better. If you're building lighting-robust training data, this is the real cv2.illuminationChange and it's exactly what you want.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| mask | NPARRAY | — | |
| alpha | FLOAT | — | |
| beta | FLOAT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |