ComfyUI Node
cv2.warpPerspective
Raw wrapper of cv2.warpPerspective(src, M, dsize, flags?, borderMode?, borderValue?, hint?). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.
cv2.warpPerspective
- src
- M
- dsize
- result
◄flagsINTER_LINEAR►
◄borderModeBORDER_DEFAULT►
◄borderValue►
◄hintALGO_HINT_DEFAULT►
Categoryimage/CV/low-level/cv2 W
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| src | COMFY_MATCHTYPE_V3 | input image. The image output(s) echo this input's format. A LATENT link is processed in latent space: frame 0 becomes a float32 [H,W,C] array (any channel count), values untouched. Arithmetic ops (add, multiply, etc.) also accept a full LATENT batch ({samples: [B,C,H,W]}) — the whole batch flows through when both inputs have the same batch size. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| M | NPARRAY | $3\times 3$ transformation matrix. A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here. | |
| dsize | CV_TUPLE | 0,0 | size of the output image. One value with 2 components (w, h) - it travels as a whole, so it cannot arrive half-connected. Wire it from 'CV Tuple' or type the components in place. |
| flagsopt | STRING | INTER_LINEAR | combination of interpolation methods (#INTER_LINEAR or #INTER_NEAREST) and the optional flag #WARP_INVERSE_MAP, that sets M as the inverse transformation ( $\texttt{dst}\rightarrow\texttt{src}$ ). cv2.warpPerspective flags: one of INTER_LINEAR, INTER_NEAREST, INTER_CUBIC, INTER_LANCZOS4 plus any of WARP_INVERSE_MAP, WARP_FILL_OUTLIERS, pipe-joined (e.g. "INTER_LINEAR | WARP_INVERSE_MAP"). In the UI this renders as a dropdown with one toggle per flag. |
| borderModeopt | COMBO | BORDER_DEFAULT | pixel extrapolation method (#BORDER_CONSTANT or #BORDER_REPLICATE). |
| borderValueopt | STRING | value used in case of a constant border; by default, it equals 0. cv2 Scalar as a literal, e.g. "(0, 255, 0)" (BGR) or "(0, 255, 0, 64)" (BGRA). A bare number broadcasts to every component, so "255" means (255, 255, 255, 255). Components past the target's channel count are ignored by OpenCV. Leave blank for the OpenCV default. | |
| hintopt | COMBO | ALGO_HINT_DEFAULT | Implementation modification flags. Set #ALGO_HINT_APPROX to use FP16 precision (if available) for linear calculation for faster speed. See #AlgorithmHint. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | COMFY_MATCHTYPE_V3 | Echoes the 'src' input's format: an IMAGE link comes back as IMAGE, MASK as MASK, NPARRAY stays NPARRAY. |