cv2.ft.FT12D_inverseFT
Turning fuzzy-transform components back into a picture
- components
- kernel
- nparray
cv2.ft.FT12D_inverseFT is the inverse F¹ transform: components in, image out. Every F-transform is a two-step fit - a forward pass that reduces each window of the image to a small set of numbers, and an inverse pass that rebuilds pixels from the overlapping window results - and this node is the second step on its own.
Use it when you want to edit the middle. Take components with FT12D_components, modify or select some of them, then rebuild here; the reconstruction only ever sees the components, so whatever you did to them is what you get. It's also the honest way to check that you understand the transform: fit and rebuild without touching anything and the result should look like a smoothed version of your input, no more.
Inputs
components- the array from the corresponding components call. It expects a single-channel 32-bit float array, which is the format theftmodule produces.kernel- and OpenCV's docs are explicit about this: it must be the same kernel that produced the components. Radius and channel count both matter; a mismatched kernel doesn't raise a helpful error, it just reconstructs something wrong.width,height- mandatory integers, and they're mandatory for a reason: components are one entry per window position, not an image-sized array, so the node has no way to know how big the result should be. Give it the dimensions of the image you started from.
One output, nparray, 32-bit float.
Both dimension widgets open at 0. Zero width and zero height produce an empty result rather than an error, which is the classic way to spend ten minutes debugging a working node.
Why you'd take it apart and put it back together
Fitting and reconstructing is the transform's whole trick: a local fit suppresses noise, so the rebuilt image is a smoothed one, and because the fit is linear rather than a plain average, smooth gradients come back as gradients instead of staircases. Do it in two nodes instead of one (FT12D_process does both steps at once) and you get a handle on the intermediate representation: mask components by position, scale them, or compare an image's components against another image's.
The round trip is also a debugging idiom worth internalising, because every F-transform node in this pack inherits it: a decomposition that doesn't reconstruct is a decomposition you've misread. The pack's own matrix workflows (56_matrix_decomposition.json) make exactly that argument for RQDecomp3x3 and the homography decompositions.
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 only exists in contrib wheels, and since every OpenCV distribution installs into the same site-packages/cv2, a non-contrib opencv-python can silently remove this node from your menu. tools/repair_opencv_contrib.py --check (then --apply) is the fix. Python ≥ 3.12, recent V3-API ComfyUI, no downloads.
Where people get burned
width/heightleft at 0. Empty output, no explanation.- A different kernel from the forward pass. Wrong reconstruction, no error.
- Wrong channel count in the components. The input wants single-channel 32-bit float; a 3-channel array gets rejected or misinterpreted depending on where the mismatch lands.
- Expecting an image out of a picture-in socket. The
componentssocket accepts IMAGE/MASK/NPARRAY like everything in this pack, but a picture is not components - wired that way it will do something, and it won't be what you wanted. - Assuming the result is the original. It isn't: it's the transform's approximation of it. If you need the original, that's the other output of your graph.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| components | NPARRAY,IMAGE,MASK | Input 32-bit float single channel array for the components. 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. The same kernel as for components computation must 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. | |
| width | INT | 0-2147483648–2147483647 | Width of the output array. |
| height | INT | 0-2147483648–2147483647 | Height of the output array. Computation of inverse $F^1$-transform. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |