OpenCV linearPolar_0
Unwrap a circular image into a straight line
- src
- dst
- nparray
Ever seen one of those "unrolled" circular images - a panorama shot around a pole, or a pie chart peeled open into a strip? That's a linear polar transform, and this node does it. OpenCV linearPolar_0 wraps cv2.linearPolar, which remaps an image from its normal x/y grid into polar coordinates around a point you choose. Circles become lines, spokes become verticals, and it costs nothing but a remap - no model, no VRAM.
It's the kind of node that sounds academic until you have the exact weird problem it solves: turning a round texture into a flat one, straightening the spokes of a wheel, de-rolling a cylindrical panorama, or generating a "polar unwrap" preview for texture work. It's also just fun to throw at a generated image and see what breaks.
How it works
Conceptually: you pick a center point, then every pixel is relocated so that its distance from the center becomes the horizontal axis and its angle becomes the vertical axis. The further out you go, the longer the row. linearPolar maps radius linearly; its cousin logPolar_0 maps radius logarithmically (more on that node separately).
The inputs that matter:
- src -
NPARRAY(yes, the whole pack works on nparrays;Image2Nparrayin,Nparrays2Imageout). - center - the pole of the transform, as a string literal:
[width/2, height/2]or an actual value like[512, 512].ast.literal_evalparses it, so brackets or parens both work; wrong syntax gives the pack's famousinvalid syntax (<unknown>, line 0). - maxRadius - how far out the transform reaches. Set it roughly to the image's max dimension and you capture the whole frame; smaller crops the unwrap.
- flags - interpolation and border mode. These are bitwise-combined OpenCV constants. The practical one is
INTER_LINEAR=1; add8(WARP_FILL_OUTLIERS) if you want the empty corners filled instead of left black.
Optional dst - an out-parameter you can ignore. The result comes back on the single nparray output.
Install
ComfyUI Manager → search "opencv" → install opencv-comfyui. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Restart. Dependencies: opencv-contrib-python, numpy, torch. No models.
Common issues
- The output isn't the size you expected. The polar remap can produce non-square results - the width is driven by
maxRadiusand the angles. Don't assume it matches the source. - Corners come out black or stretched. Tune
maxRadiusand addWARP_FILL_OUTLIERS(bit8) to the flags. invalid syntax- check yourcenterliteral.- Batch error - the pack is
batch_size==1only; slice withImageFromBatchbefore converting.
Honest take: you will almost certainly not need this for ordinary SD/Flux work. It lives in the pack's "small and quick transformations" lane, and it's great there - when a round object needs flattening, nothing else in ComfyUI does it in one node.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| center | STRING | — | |
| maxRadius | FLOAT | — | |
| flags | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |