cv2.ft.FT12D_components
The fuzzy transform's model of your image, before it's turned back into pixels
- matrix
- kernel
- nparray
cv2.ft.FT12D_components is the forward half of the F¹ fuzzy transform and nothing else. No inverse pass, no rebuilt image - just the components: OpenCV's own docs describe the output as a 32-bit float array of linear components computed with the kernel you supply.
Why would you want half a transform? Because the components are the model of the image, and a model is something you can edit. Rebuild from untouched components and you get a smoothed image; suppress or scale some components and rebuild, and you've filtered the image without ever touching pixels directly. That's the same trick that makes the mask-editing workflow in the ft module work.
What's in the array
The F¹ transform slides a (2r+1)² window across the image - r is the kernel radius - and fits a plane to what's under it. The components array holds the result of those fits, one entry per window position, which is why it isn't the same shape as your image. It's a compact representation, not a picture.
That size mismatch is also why the reconstruction node (FT12D_inverseFT) demands a width and a height from you: the components don't carry them. Remember that pairing and the round trip is straightforward; forget it and you'll be staring at an output array wondering why it has the wrong dimensions.
Inputs
matrix- IMAGE, MASK or NPARRAY. An IMAGE arrives as a uint8 BGR frame, and only frame 0 of a batch is used - theftfunctions aren't on the pack's frame-batch list, so a video gives you one frame, silently.kernel- fromcv2.ft.createKernel. Radius lives here, and the cost is quadratic in it. The default radius of 0 gives a 1×1 kernel.
One output, nparray, 32-bit float. NPARRAY, so Inspect CV Data for the numbers and Preview CV Array if you must look at it.
There's no mask input on this node, and that's not an oversight you can work around by wiring one anyway - the components-only call has no mask parameter in OpenCV either. Neighbouring nodes in the family (FT12D_process, FT12D_polynomial) do take one, so if you need "exclude this region from the fit", that's where you go.
The two nodes it belongs to
FT12D_createPolynomMatrixHorizontal/…Verticalbuild the helper matrices the gradient side of this machinery uses. If you're assembling the F¹ pipeline by hand rather than calling the wrapper functions, they're the pieces that make the linear term computable.FT12D_inverseFTturns components back into an image - same kernel, plus the width and height.
Install
Manager → search ComfyUI CV, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
pip install "opencv-contrib-python-headless~=5.0.0.93"
Restart ComfyUI. ft is a contrib module, and all four OpenCV wheels share one site-packages/cv2 directory - install plain opencv-python and every node in this family quietly vanishes from the menu. tools/repair_opencv_contrib.py --check is the diagnosis, --apply the fix. Python ≥ 3.12 and a recent V3-API ComfyUI.
Where people get burned
- Treating components as an image. Wrong size, wrong interpretation. It's a model, not a frame.
- Radius 0. A
(2r+1)²kernel withr = 0is 1×1, and the transform becomes a no-op that returns something which looks structurally right and is useless. - Kernel channels that don't match the image. 3 for BGR, 1 for greyscale, or cv2 throws.
- Forgetting the width/height on the way back. The inverse node will happily produce a wrong-sized canvas at you.
- No community safety net. No shipped workflow in the pack uses the F¹ components pipeline, and the module is deep contrib territory with essentially no tutorials anywhere. That's fine for experimentation and a bad place to build something you need to support.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| matrix | NPARRAY,IMAGE,MASK | Input array. 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. | |
| kernel | NPARRAY,IMAGE,MASK | Kernel used for processing. Function `ft::createKernel` can be used. 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. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |