OpenCV boxFilter_0
The general blur where normalize is the switch
- src
- dst
- nparray
OpenCV boxFilter_0 is cv2.blur's general form - and blur is just this node with the normalize switch set to True. That's the whole secret: a box filter sums every pixel in a ksize window; with normalize on, it divides by the window area so the result is an average (a blur); with normalize off, you get the raw sum, which is a different beast entirely - a sum that grows with brightness, used in integral-image-style tricks and brightness analysis. One node, two personalities, one boolean apart.
For the everyday ComfyUI user the normalized side is the one you want: a plain, fast box blur - the cheapest smoothing primitive in OpenCV, ideal when you need to soften a region and don't need Gaussian's round falloff. The unnormalized side is niche - it produces values that overflow the 0–255 range fast, so you'd only use it when you're deliberately doing window-sum math and will rescale yourself.
It's part of opencv-comfyui, the auto-generated pack wrapping OpenCV's standalone functions. The node calls cv2.boxFilter(src, ddepth, ksize, dst, anchor, normalize, borderType) straight through. boxFilter_1 is the duplicate overload - no behavioral difference.
Inputs that matter
- src - your
NPARRAYimage (BGR,uint8; viaImage2Nparray). - ddepth - INT, the output depth. Set
-1to keep the source's depth - that's what you want 99% of the time. Other values (like6for CV_64F) are for float math you'll rarely need here. - ksize - STRING literal, a Python list:
[5, 5]. Keep it odd. Wrong syntax →invalid syntax (<unknown>, line 0), the pack's signature error. - normalize - BOOLEAN. True = average = blur. False = raw window sum. This is the knob that matters.
- anchor - STRING literal
(-1, -1)(kernel center). Leave it. - borderType - INT,
4(BORDER_DEFAULT) is fine. - dst (optional) - out-parameter; leave unwired.
Output: one nparray → Nparrays2Image to preview.
Install and gotchas
ComfyUI Manager → opencv-comfyui, or git clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes, restart. Needs opencv-contrib-python (near-certain already-have).
Pack-wide traps apply: batch size 1 only (slice with ImageFromBatch), and everything in/out is NPARRAY, so you own BGR vs RGB. If your "blur" comes out looking solarized, check normalize - that's the switch people flip by accident when they meant a soft average and got a window sum. For most workflows, honestly, the named blur node or a Gaussian variant reads clearer than this general one; boxFilter earns its place when you need the sum behavior or you're building a CV pipeline and want the full signature available.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| ddepth | INT | — | |
| ksize | STRING | — | |
| anchor | STRING | — | |
| normalize | BOOLEAN | — | |
| borderType | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |