Nodes/ComfyUI CV/cv2.ft.FT02D_FL_process
ComfyUI Node

cv2.ft.FT02D_FL_process

Fuzzy-transform smoothing in one node

By bmad4ever·Created 4 months ago·Updated 15 days ago· 1
cv2.ft.FT02D_FL_process
  • matrix
  • nparray
◄radius0►

If the cv2.ft nodes look like a chain - build a kernel, forward transform, edit coefficients, inverse transform - this is the node that skips the whole chain. FT02D_FL_process does the fuzzy transform and its inverse in one step, using the linear basis function, with nothing to feed it but your image and a radius. OpenCV's own description calls it roughly ten times faster than the general FT02D_process path, and the name spells out why: FL for fast, linear.

Which makes it the approachable entry point to the fuzzy transform. If you're curious what it does to a photo - and it's a genuinely different look from a Gaussian, because the image comes back rebuilt from a coarse partition rather than convolved - this is the node to experiment with.

It's a raw wrapper in ComfyUI CV (bmad4ever), the pack that exposes OpenCV 5.0 to ComfyUI as roughly 470 auto-generated cv2.* wrappers plus a curated layer. Raw means OpenCV's signature: two inputs, one output, and a radius field that ports cv2's default rather than picking a useful one.

The two inputs

  • matrix - the image. The tooltip is explicit that cv2 expects 3 channels here, so it's the colour path: feed an IMAGE directly (the pack converts it to a uint8 BGR array, frame 0 of a batch) rather than a single-channel MASK. Grayscale work means converting to a 3-channel array first, not handing over the mask.
  • radius - the fuzzy partition's spacing, i.e. the smoothing scale. It's the only real decision. The widget defaults to 0, and (2·0+1) is a 1×1 kernel, so a radius of 0 means "do nothing" - that's the number one reason someone runs this node and concludes it's broken. Pick a radius relative to the image: small for a gentle approximation, a noticeable fraction of the frame for a hard coarsening.

The output is a single NPARRAY. Note the socket type: this node doesn't echo your input's format the way cv2.ft.filter does, so an IMAGE link turns into a raw ndarray and needs CV Array → Image (or Preview CV Array) before you can look at it.

When to reach for this instead of ft.filter

Use FT02D_FL_process when you want the effect and don't want to think about kernels: one node, one radius, done. Use cv2.ft.createKernel + cv2.ft.filter when you want to reuse a kernel across several images (build once, apply many), and cv2.ft.FT02D_components + FT02D_inverseFT when you want to touch the coefficients in between.

And the honest comparison to the rest of the pack: this is a smoothing/approximation filter, not an edge-preserving one. If the goal is "denoise but keep edges crisp", the bilateral and guided filters are the right tools and the fuzzy transform is not - it will flatten the detail it decides is below the partition scale regardless of whether that detail was noise or eyelashes. Where it shines is deliberate coarsening: preparing a mask's shape, extracting the large-scale structure of a texture, or that "what does this look like through a coarse lens" experiment.

Install

ComfyUI Manager → search ComfyUI CV, or:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install -r comfyui_cv/requirements.txt

Python ≥3.12 and a recent ComfyUI (the pack is built on the V3 node API); restart ComfyUI after installing. The dependency is opencv-contrib-python-headless~=5.0.0.93. The ft module is contrib-only, so on a plain opencv-python wheel this node doesn't exist at all - and because all four OpenCV pip distributions share one site-packages/cv2, installing the non-contrib wheel on top of the contrib one empties the contrib submodules silently. The pack's repair tool diagnoses and fixes that:

python ComfyUI/custom_nodes/comfyui_cv/tools/repair_opencv_contrib.py --check

Common issues

"It did nothing." Radius 0.

"It's a grey mush." Radius far too large for the image. Halve it and compare - the change is not subtle.

A cv2 error about channels. You fed a mask. This entry point wants a 3-channel matrix.

Multi-frame batches only process frame 0. This function isn't on the pack's per-frame list, so a whole IMAGE batch doesn't flow through. Loop, or process frame by frame.

Want it more accurate? cv2.ft.FT02D_FL_process_float is the same one-step algorithm on the floating-point path, and OpenCV's own note calls it the more accurate of the two.

Categoryimage/CV/low-level/ft

Inputs (2)

NameTypeDefaultDescription
matrixNPARRAY,IMAGE,MASKInput 3 channels matrix. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
radiusINT0-2147483648–2147483647Radius of the `ft::LINEAR` basic function.

Outputs (1)

NameTypeDescription
nparrayNPARRAY—