Nodes/opencv-comfyui/OpenCV estimateAffinePartial2D_1
ComfyUI Node

OpenCV estimateAffinePartial2D_1

EstimateAffinePartial2D_1 — identical twin, use _0 instead

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV estimateAffinePartial2D_1
  • from_
  • to
  • inliers
  • nparray_0
  • nparray_1
method
ransacReprojThreshold
maxIters
confidence
refineIters

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) - 0 least squares, 8 RANSAC (default), 4 LMEDS, 16 RHO.
  • 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.

Categoryimage/OpenCV

Inputs (8)

NameTypeDefaultDescription
from_NPARRAY
toNPARRAY
methodINT
ransacReprojThresholdFLOAT
maxItersINT
confidenceFLOAT
refineItersINT
inliersoptNPARRAY

Outputs (2)

NameTypeDescription
nparray_0NPARRAY
nparray_1NPARRAY