OpenCV remap_0
Bend any image any way you like — remap_0 is the master warp
- src
- map1
- map2
- dst
- nparray
remap_0 is the heavy artillery of geometric transforms. While a perspective or affine warp is a single fixed formula, remap lets you move every pixel to an arbitrary location of your choosing. Lens distortion correction, fisheye removal, barrel distortion, swirl effects, polar-to-cartesian math, undistortion from camera calibration - all of it funnels through this one node, wrapped for ComfyUI by opencv-comfyui (geroldmeisinger/opencv-comfyui).
Here's the mental model: you supply two maps that describe, for each destination pixel, which source pixel to sample. map1 holds the x-coordinates, map2 the y-coordinates. The output is the source image resampled through those maps. That's the whole trick - and it's also the whole difficulty, because in a pure ComfyUI graph, generating the maps is the hard part.
The inputs that matter
src- the image you're warping, anNPARRAYfromImage2Nparray.map1-NPARRAY,float32. Either a single-channel (H, W) grid of destination→source x-coordinates, or a two-channel (H, W, 2) map wheremap2then stays empty.map2-NPARRAY,float32, the y-coordinate map (single-channel form). Ifmap1is two-channel, this is ignored.interpolation-0nearest,1linear (the default),2cubic,4Lanczos. Linear is fine for distortion work.borderMode- what to do where the map points off-image:0constant,1replicate edge,2reflect,3wrap,4reflect-101.borderValue- a Scalar literal(B, G, R)used only for constant borders. And yes, BGR.
Output is the remapped nparray, which goes to Nparrays2Image and back into normal ComfyUI.
The honest warning
This is the node where the pack's "Expect dragons" banner is most earned. The maps must be float32 numpy arrays of exactly the right shape - feed it anything else and you get the classic map1 must be CV_32FC1 assertion crash. And producing those maps inside ComfyUI means either a python/node-js node that can build numpy arrays, or precomputed maps from a calibration script loaded some other way. There is no built-in "make a fisheye map" widget, and there won't be - this pack is a thin wrapper, not a convenience layer.
So: if you already have undistortion maps from a camera-calibration pass (the standard output of OpenCV's stereo/calibration tooling), remap_0 is exactly right. If you're hoping for a no-code barrel-distortion slider, this isn't the node - you'd be happier with one of the Image-Filters style packs for casual effects.
Installing it
ComfyUI Manager (search "opencv-comfyui"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
restart, then confirm OpenCV:
pip install opencv-contrib-python
And remember the borderValue literal rule: (0, 0, 0) parses, 0, 0, 0 throws the pack's signature invalid syntax error.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| map1 | NPARRAY | — | |
| map2 | NPARRAY | — | |
| interpolation | INT | — | |
| borderMode | INT | — | |
| borderValue | STRING | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |