OpenCV estimateAffine2D_1
EstimateAffine2D_1 — a byte-identical twin, so just use _0
- from_
- to
- inliers
- nparray_0
- nparray_1
This is the same node as estimateAffine2D_0, in every way that matters. Same inputs, same outputs, and if you compare the generated source classes, they're copy-paste identical. The _1 suffix is an overload-numbering artifact of opencv-comfyui (geroldmeisinger/opencv-comfyui): the pack parses OpenCV's type stubs, which declare cv2.estimateAffine2D with two slightly different signatures, and emits one node per overload. The generator found both signatures near-identical, and here they are, twins. Grab _0 and move on - nothing in your graph will know the difference.
What it does
Computes a 2×3 affine transform (rotation + scale + shear + translation) that maps one set of 2D points onto a matching set. You give it matched keypoints from two views of the same content - consecutive video frames, a reference and a distorted copy - and it returns the transform, using RANSAC by default so a few bad matches don't wreck the fit. That matrix is then typically fed to a warpAffine node to actually move the image. It's geometry math, deterministic, no model involved.
Inputs and outputs
- from_ (NPARRAY) - source points, N×2.
- to (NPARRAY) - matching destination points, N×2.
- method (INT) - fit algorithm:
0least squares,8RANSAC (default, robust to outliers),4LMEDS,16RHO. - ransacReprojThreshold (FLOAT) - inlier tolerance; ~3.0 default, raise for noisy matches.
- maxIters (INT), confidence (FLOAT), refineIters (INT) - RANSAC tuning; defaults are fine.
- inliers (NPARRAY, optional) - out-parameter, leave unconnected.
- Outputs: nparray_0 - 2×3 transform matrix; nparray_1 - inlier mask (1 = trusted).
Wiring and the honest take
The plumbing is the same as _0: point arrays in as nparrays, transform out, and the inlier output isn't a displayable image (it's a 1-D array - if you feed it to Nparrays2Image you'll get the pack's classic 'NoneType' object has no attribute 'shape' error). This node is genuinely useful for alignment/registration pipelines, but it's a math node wearing a ComfyUI costume - expect to build and wire the point arrays yourself. Most users will get more mileage from this pack's image-level nodes (equalizeHist, erode, extractChannel) than from the point-geometry family.
Install and gotchas
Install via 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. Watch for the pack's shared traps - batch_size > 1 images (fix with ImageFromBatch), wrong-syntax literal strings, and the author's blanket "Expect dragons!" warning. Full walkthrough is on the estimateAffine2D_0 page; this one is just its twin.
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 | — |