OpenCV invertAffineTransform_1
The same undo-matrix, second overload
- M
- iM
- nparray
If you've read any other _1 page in this pack, you can predict this one: OpenCV invertAffineTransform_1 is the duplicate overload of invertAffineTransform_0. cv2.invertAffineTransform is listed twice in OpenCV's type stubs (MatLike and UMat), the generator emitted two numbered nodes, and they behave identically. The mechanics live in the _0 article; here's the short version.
What it does
Inverts a 2×3 affine transform matrix - rotation, scale, translation, shear, or any combo - producing the matrix that undoes it. Feed the output of getRotationMatrix2D_0 or warpAffine_0 in, get the inverse back, and run a round-trip warp. It's a one-parameter-free utility: give it a valid invertible matrix and it just works.
Inputs and outputs
M- NPARRAY, the 2×3 affine matrix.iM- optional out-parameter (returned anyway).- Output
nparray- the 2×3 inverse.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
cd opencv-comfyui
pip install -r requirements.txt
or ComfyUI Manager → "opencv-comfyui". No model downloads; deps are opencv-contrib-python, numpy, torch.
Gotchas
Two cautions, both inherited from the _0 twin. First, a degenerate M (zero scale, collapsed dimension) yields garbage silently - no error, just wrong numbers, so verify by composing the matrix with its inverse when the result matters. Second, this is transform-matrix math, not image math: it won't invert image colors or images at all. And the _1 suffix carries no extra features - it's pure overload numbering, so use whichever variant your workflow references and don't read anything into the choice.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| M | NPARRAY | — | |
| iMopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |