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

cv2.ft.FT02D_FL_process_float

The careful version of the one-step fuzzy filter

By bmad4ever·Created 3 months ago·Updated 14 days ago· 1
cv2.ft.FT02D_FL_process_float
  • matrix
  • nparray
◄radius0►

cv2.ft.FT02D_FL_process_float is cv2.ft.FT02D_FL_process on the floating-point path. Same one-step fuzzy transform - forward and inverse in a single call, linear basis, no kernel node required, just an image and a radius - but it works in float rather than the fast 8-bit route. OpenCV's own description says the float variant is more accurate than its integer sibling and around nine times faster than the general FT02D_process, and the only reason two functions with identical signatures exist is that they take different numeric paths. If you're doing measurement rather than aesthetics, this is the one you want, because the 8-bit path quantises on the way in and out.

It's a raw wrapper in ComfyUI CV (bmad4ever), the pack wrapping OpenCV 5.0 as ComfyUI nodes. This corner (cv2.ft, the fuzzy transform module) is obscure enough that OpenCV's own documentation is terse, and the pack's contribution is honest: tooltips for the parameters, a wrapper that catches cv2's error and re-raises it with the shapes it actually passed, and a registry that only includes functions your installed OpenCV build can actually run.

Inputs and output

  • matrix - the image, and cv2 wants 3 channels here (the tooltip says so), so a single-channel MASK will be rejected. If you have a grayscale array, replicate it to three channels first - CV Concat Arrays builds a 3-channel NPARRAY from one, or take the colour path and convert.
  • radius - the fuzzy partition's spacing and therefore the smoothing scale. The widget defaults to 0, and a radius of 0 gives a 1×1 kernel: no smoothing. Set it. Relative to image size, a small radius is a light approximation, a large one is a hard coarsening that keeps only the broad structure.
  • Output: nparray, the reconstructed image, as a raw array - not a format-echoing socket, so route it through CV Array → Image to preview, or Preview CV Array, which can normalise floats or show them as a heatmap.

Because the output is a float array, this variant is also the one to use when the result feeds maths rather than pixels: compare two reconstructions with cv2.absdiff, or feed the array onward into measurement nodes instead of converting back to 8-bit and losing the precision you just bought.

Where this fits

Three ways to run the fuzzy transform in this pack, and it pays to know which you're choosing:

  1. One step, fast, 8-bit - cv2.ft.FT02D_FL_process.
  2. One step, float, more accurate - this node.
  3. The full chain - cv2.ft.createKernel + cv2.ft.filter, or createKernel + FT02D_components + FT02D_inverseFT if you want to see or edit the coefficients. Slower, and the only route where you control the partition itself.

There are more ft nodes than that in the category - the polynomial FT12D_* family and the iterative FT02D_iteration - all generated, all with the same uncurated flavour. They're there if you want them; the linear one-step nodes are the ones with a clear job.

And the usual caveat about this filter family: it approximates. Detail below the partition scale is gone whether it was noise or texture, so it's a coarsening tool, not an edge-preserving denoiser. For "smooth but keep the edges", bilateral or guided filtering is the right family.

Install

ComfyUI Manager → 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, current ComfyUI (V3 node API), restart afterwards. Dependency: opencv-contrib-python-headless~=5.0.0.93. cv2.ft is contrib-only - on a plain opencv-python wheel this node doesn't exist, and because every OpenCV pip distribution shares one site-packages/cv2, installing the non-contrib wheel over a contrib one silently empties the contrib submodules. If whole categories have vanished from your node search, that's why:

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

Common issues

No visible change. Radius 0, again. It's the default and it's the trap.

Everything is a flat haze. Radius too big: the partition has too few coefficients to describe anything, so the inverse hands you back an abstraction.

cv2 complains about the input. One channel instead of three. Build the 3-channel array first.

Values that look wrong when you preview it as an image. Float arrays aren't 0–255 pictures; use the preview node's normalise or heatmap mode, and remember that the float path is worth keeping as data rather than squashing to 8-bit immediately.

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—