Nodes/opencv-comfyui/OpenCV linearPolar_1
ComfyUI Node

OpenCV linearPolar_1

OpenCV linearPolar_1 — the polar unwrap node, minus the mystery

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV linearPolar_1
  • src
  • dst
  • nparray
center
maxRadius
flags

OpenCV linearPolar_1 is the same node as OpenCV linearPolar_0. Every _0/_1 pair in opencv-comfyui is one function twice - OpenCV declares each function for plain matrices and for OpenCL-backed UMat images, and the generator numbered the two overloads instead of merging them. Same inputs, same output, same results. So read this for what the transform does, and treat linearPolar_0 as your copy of the manual.

What it does: remaps an image into polar coordinates around a center point, turning circles into straight lines. Distance from the center becomes the horizontal axis, angle becomes the vertical axis. Linear in the radius, hence the name.

When you'd actually use it

  • Unrolling circular content - cylindrical panoramas, dials, wheel spokes, anything where "around a circle" is the geometry.
  • Texture work - flattening a round pattern so you can edit it as a strip, then warp it back (there's no inverse-node in the pack, but warpPolar exists as another pair if you want to round-trip).
  • Just poking at generated images - it's deterministic, instant, and a great way to see structure a straight view hides.

The inputs

  • src - NPARRAY in, via Image2Nparray. Back out via Nparrays2Image.
  • center - string literal, e.g. [512, 512] or (width/2, height/2). The pack parses these with ast.literal_eval, so a typo means invalid syntax (<unknown>, line 0).
  • maxRadius - reach of the transform from the center. Set to about the max dimension of the image to grab the whole frame.
  • flags - interpolation + border bits. 1 is INTER_LINEAR; add 8 (WARP_FILL_OUTLIERS) to fill the empty corner regions instead of leaving them black.

Optional dst is a call-by-reference out-parameter in the OpenCV tradition. The README's advice applies: avoid feeding it. The result lands on the nparray output.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python

Restart, or install via ComfyUI Manager (search "opencv"). The requirements are just opencv-contrib-python, numpy, torch - nothing to download beyond that.

Gotchas

  • Non-square output - don't assume the result matches your source dimensions; the unwrap width follows maxRadius and angle range.
  • Black or stretched corners - raise maxRadius and/or set flag bit 8.
  • Batch error - Only images with batch_size==1 are supported!ImageFromBatch, length=1.
  • Color-channel surprise - nparrays are BGR. If colors look swapped on the way out, that's expected until Nparrays2Image flips them back.

Fair warning: this is niche. If your workflow never involves circular geometry, you can skip it without guilt - the pack is huge precisely because it wraps every top-level cv2 function, not because you need them all. When you do need a polar unwrap, though, it's a one-node answer.

Categoryimage/OpenCV

Inputs (5)

NameTypeDefaultDescription
srcNPARRAY
centerSTRING
maxRadiusFLOAT
flagsINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY