Nodes/comfyui_cv/cv2.remap
ComfyUI Node

cv2.remap

Raw wrapper of cv2.remap(src, map1, map2, interpolation, borderMode?, borderValue?, hint?). Parameters marked '?' are optional; blank means OpenCV default. See the OpenCV documentation for details.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
cv2.remap
  • src
  • map1
  • map2
  • result
interpolationINTER_LINEAR
borderModeBORDER_DEFAULT
borderValue
hintALGO_HINT_DEFAULT
Categoryimage/CV/low-level/cv2 R

Inputs (7)

NameTypeDefaultDescription
srcCOMFY_MATCHTYPE_V3Source 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.
map1NPARRAYThe first map of either (x,y) points or just x values having the type CV_16SC2 , CV_32FC1, or CV_32FC2. See #convertMaps for details on converting a floating point representation to fixed-point. A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here.
map2NPARRAYThe second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively. A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here.
interpolationSTRINGINTER_LINEARInterpolation method (see #InterpolationFlags). The methods #INTER_AREA #INTER_LINEAR_EXACT and #INTER_NEAREST_EXACT are not supported by this function. The extra flag WARP_RELATIVE_MAP can be ORed to the interpolation method (e.g. INTER_LINEAR | WARP_RELATIVE_MAP) cv2.remap flags: one of INTER_LINEAR, INTER_NEAREST, INTER_CUBIC, INTER_LANCZOS4 plus any of WARP_RELATIVE_MAP, WARP_FILL_OUTLIERS, WARP_INVERSE_MAP, pipe-joined (e.g. "INTER_LINEAR | WARP_RELATIVE_MAP"). In the UI this renders as a dropdown with one toggle per flag.
borderModeoptCOMBOBORDER_DEFAULTPixel extrapolation method (see #BorderTypes). When borderMode=#BORDER_TRANSPARENT, it means that the pixels in the destination image that corresponds to the "outliers" in the source image are not modified by the function.
borderValueoptSTRINGValue used in case of a constant border. By default, it is 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.
hintoptCOMBOALGO_HINT_DEFAULTImplementation modification flags. Set #ALGO_HINT_APPROX to use FP16 precision (if available) for linear calculation for faster speed. See #AlgorithmHint.

Outputs (1)

NameTypeDescription
resultCOMFY_MATCHTYPE_V3Echoes the 'src' input's format: an IMAGE link comes back as IMAGE, MASK as MASK, NPARRAY stays NPARRAY.