Nodes/opencv-comfyui/OpenCV divide_1
ComfyUI Node

OpenCV divide_1

Same per-pixel division, no difference

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV divide_1
  • src1
  • src2
  • dst
  • nparray
scale
dtype

divide_1 is divide_0 under a different suffix - same cv2.divide(src1, src2, scale, dtype), same four required inputs, same single NPARRAY output. The _0/_1 split is the opencv-comfyui generator numbering the MatLike and UMat overload declarations separately; both end up identical on the Comfy side. There's genuinely nothing to decide between them, so if the search box surfaced both, close your eyes and grab one.

The content lives on the divide_0 page. Recap: this is per-pixel division of two same-sized images, output = src1 × scale / src2. The headline use is flat-field correction - divide an image by a heavily blurred copy of itself to cancel uneven lighting and get a clean ratio image. It's also the primitive for ratio masks, comparing exposures, and normalizing. Instant, deterministic, and the right tool for jobs people sometimes burn a diffusion pass on by mistake.

Inputs: src1 (NPARRAY, numerator), src2 (NPARRAY, denominator - same shape; mind the zeros, since 0-division produces ugly type-dependent results), scale (FLOAT, default 1), dtype (INT, -1 = same as inputs). Skip the optional dst out-parameter. Output: one nparray, the ratio image.

One thing worth repeating because it catches people: this node always divides image-by-image - there's no way to divide an image by a constant here. If you want a constant divided by your image (the scaled reciprocal, used for per-pixel inversion), that's the divide_2/divide_3 overload: scale/src2. Same family, different job; knowing which overload is which saves you a confusing error.

Pack-wide plumbing, verbatim: NPARRAY in and out, so Image2Nparray before and Nparrays2Image after, and only batch_size==1 is supported (ImageFromBatch length=1 if a batch sneaks through).

Install: part of geroldmeisinger/opencv-comfyui - ComfyUI Manager → search "OpenCV", or:

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

restart, with opencv-contrib-python installed. If the whole pack refuses to load with Cannot import name 'guidedFilter' from 'cv2.ximgproc', that's conflicting OpenCV wheels - fix the conflict, not the node.

When you're choosing between the four divide_* nodes, the decision tree is one level deep: image divided by image → _0 or _1; image divided by a constant → _2 or _3. Done.

Categoryimage/OpenCV

Inputs (5)

NameTypeDefaultDescription
src1NPARRAY
src2NPARRAY
scaleFLOAT
dtypeINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY