cv2.ft.FT12D_createPolynomMatrixVertical
The other half of the fuzzy transform's gradient basis
- nparray
cv2.ft.FT12D_createPolynomMatrixVertical is the y-axis counterpart of …Horizontal: a helper matrix for the F¹ fuzzy transform's gradient computation, generating the vertical term instead of the horizontal one. Same two inputs, same single output, same one-line entry in the OpenCV docs.
Since the two are nearly identical, here's the useful way to think about the pair rather than repeating the horizontal article.
What "gradient computation" means here
The F¹ transform fits a plane to each window of the image: a constant term, plus a slope in each direction. The polynomial variant of this family hands you exactly those three pieces per window - average colour, average horizontal gradient, average vertical gradient - which is how the transform ends up being used for derivative-like analysis without the noise amplification you get from differencing neighbouring pixels with a Sobel.
This node builds the vertical basis matrix for that fit. It's the y-side sibling of the horizontal helper; in a hand-built F¹ pipeline you'd expect to have both in the graph, cutting the same components array along two axes. The two coefficients they correspond to are the ones OpenCV calls c01 and c10 in the polynomial call - one per direction.
Inputs, both required and both opening at zero:
radius- radius of the basic function, matching your kernel. Radius 0 is a 1×1 degenerate basis.chn- channel count to build for: 3 for BGR, 1 for greyscale.
Output: one nparray matrix.
Is it worth your time?
Only if you're plumbing F¹ internals by hand. For any normal gradient job, Sobel, Scharr or getDerivKernels in this same pack will get you there with documentation you can actually read and a community that can help when it goes wrong. This node exists because the pack's registry auto-generates a wrapper for every top-level function the installed OpenCV exposes - not because anyone asked for it.
If you do want to see the basis, do this: build both helpers at the same radius, run each through Inspect CV Data, and compare. The difference between the two matrices is a compact answer to "how does the F¹ transform think about a direction" - which is genuinely interesting if you're trying to understand the fuzzy transform, and useless if you just want edges.
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. The ft module only exists in contrib wheels, and all four OpenCV distributions share one site-packages/cv2 - installing plain opencv-python at any point can silently strip the contrib submodules and delete this node from your menu. tools/repair_opencv_contrib.py --check, then --apply, is the repair. Python ≥ 3.12, recent V3-API ComfyUI, no downloads.
Where people get burned
- Radius or channel count left at 0. Both defaults are wrong; both need to match the kernel and the image.
- Assuming the horizontal and vertical helpers are interchangeable. They're basis matrices for different axes; swapping them gives you a fit that's wrong in a way that still looks like a smoothed image.
- Reading the output as an image. It's an NPARRAY matrix. Use
Inspect CV Data, not a preview node. - Building on it in production. The pack's README is upfront that it's AI-assisted, uncurated at the low level, and not intended for production use without your own review. That warning lands hardest on exactly this kind of node.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| radius | INT | 0-2147483648–2147483647 | Radius of the basic function. |
| chn | INT | 0-2147483648–2147483647 | Number of channels. The function creates helper vertical matrix for $F^1$-transfrom processing. It is used for gradient computation. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |