OpenCV estimateAffinePartial2D_1
EstimateAffinePartial2D_1 — identical twin, use _0 instead
- from_
- to
- inliers
- nparray_0
- nparray_1
estimateAffinePartial2D_1 is estimateAffinePartial2D_0 with a different number. Same inputs, same outputs, same generated code - the opencv-comfyui (geroldmeisinger/opencv-comfyui) generator emits one node per OpenCV stub overload and numbers them _0, _1, etc., so when the overloads are near-identical you get twins. Use _0. Nothing is gained by choosing this one.
What it does
Estimates a "partial" 2D affine transform - rotation, uniform scale, and translation only, no shear - that maps one set of matched 2D points onto another. The constraint is the point: when you know two views differ only by zoom/rotate/pan (consecutive video frames, a reference and a panned shot), this model is more stable than the full 6-DOF estimateAffine2D, because it doesn't waste freedom fitting distortion that isn't there. RANSAC is the default estimator, so stray bad matches get rejected rather than skewing the result.
Inputs and outputs
- from_ (NPARRAY) - source points, N×2.
- to (NPARRAY) - matching destination points, N×2.
- method (INT) -
0least squares,8RANSAC (default),4LMEDS,16RHO. - ransacReprojThreshold (FLOAT) - inlier tolerance, ~3.0 default.
- maxIters (INT), confidence (FLOAT), refineIters (INT) - RANSAC tuning; defaults are fine.
- inliers (NPARRAY, optional) - out-parameter, leave unconnected.
- Outputs: nparray_0 - 2×3 transform; nparray_1 - inlier mask (1 = trusted).
Wiring it up
Point arrays in, transform out - a math node, so you build the input arrays yourself. Feed nparray_0 into the pack's warpAffine_0 node to apply the transform to an image. The inlier output is a 1-D array, not an image; feeding it into Nparrays2Image produces the pack's standard 'NoneType' object has no attribute 'shape' error. If all you need is image alignment without the geometry lecture, estimateAffine2D_0 is the more general sibling - use that one unless the shear-less constraint is exactly what you want.
Install and gotchas
ComfyUI Manager (search "opencv-comfyui") or git clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes, then restart. Dependencies: opencv-contrib-python, numpy, torch; no model files. Pack-wide traps: Image2Nparray only handles batch_size 1, string composites are Python literals, and the author's blanket "Expect dragons!" warning applies. Full walkthrough is on the estimateAffinePartial2D_0 page.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| from_ | NPARRAY | — | |
| to | NPARRAY | — | |
| method | INT | — | |
| ransacReprojThreshold | FLOAT | — | |
| maxIters | INT | — | |
| confidence | FLOAT | — | |
| refineIters | INT | — | |
| inliersopt | NPARRAY | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| nparray_0 | NPARRAY | — |
| nparray_1 | NPARRAY | — |