OpenCV warpPolar_0
The polar remap node
- src
- dst
- nparray
Most of this pack is plumbing you reach for when you need to fix something - straighten, correct, clean up. warpPolar is the fun one. It remaps an image between polar and Cartesian coordinates, which is how you turn a flat image into a "little planet" (that swirling sphere-in-a-circle effect), or unwrap a circular/annular texture into a rectangular strip, or undo a fisheye's circular projection. If you've seen those videos of a street scene melting into a vortex, this is the operation doing the melting.
How it works
Polar warping re-expresses every pixel by distance and angle from a center point instead of by x/y. Pick a center, a maxRadius to bound the circle you care about, and a dsize for the output, and the node re-samples the image accordingly. Two flavors live in the flags int: WARP_POLAR_LINEAR (256) keeps radial distances linear, and WARP_POLAR_LOG (512) spaces them logarithmically - the log version is what makes a fisheye's dense center spread out into a uniform panorama-like strip. Add WARP_INVERSE_MAP (16) to run the transform backwards, going from polar back to Cartesian.
Inputs and outputs
src- theNPARRAYimage (Image2Nparrayfirst).dsize- output size as a literal, e.g.(720, 360)- width × height of the result.center- the pole of the transform as a literal point,(w // 2, h // 2)style.//works because it's parsed as Python;(256, 256)is fine too.maxRadius-FLOAT; the radius (in source pixels) that maps to the edge of the output. Too small clips the image, too large wastes output space.flags- interpolation bits OR'd with the polar mode. A working recipe:257(INTER_LINEAR=1 + WARP_POLAR_LINEAR=256). For the log/unwrap version:513.
Optional dst - skip it. Output: one nparray, the warped image.
Installing
Standard pack install. ComfyUI Manager, search "opencv-comfyui", install, restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
Dependencies: opencv-contrib-python, numpy, torch.
The fiddly bits
- Flags are easy to get wrong, and there's no tooltip to catch you.
256linear vs512log vs the+16inverse - test each on a copy of your image before committing. centerandmaxRadiusare literal strings -(256, 256)not256 256. Get that wrong and you'll seeinvalid syntax (<unknown>, line 0).- Preview confusion: the output of the forward pass is a polar strip that can look like a mess until you understand what you asked for. That's normal; the result makes sense as a strip, not as a picture.
This is a niche-fun node, honestly. In a ComfyUI generation workflow you'll reach for it for a stylized shot or a texture job, not for daily work. But when you want the little-planet look, it's the exact right primitive, deterministic and free.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| dsize | STRING | — | |
| center | STRING | — | |
| maxRadius | FLOAT | — | |
| flags | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |