OpenCV logPolar_1
OpenCV logPolar_1 — same foveal transform, different overload number
- src
- dst
- nparray
Let's get the boring truth out first: logPolar_1 and logPolar_0 are interchangeable. The pack generates _0/_1 pairs for every function because OpenCV's type stubs declare each one twice (for MatLike and for OpenCL UMat), and the generator numbered the overloads. Both wrappers call the same cv2.logPolar and behave identically. Pick the one that's already on your canvas.
What the function does is more interesting. It remaps the image into log-polar coordinates: angle on one axis, log-of-radius on the other. The magic property: rotate the source and the result shifts vertically; zoom the source and it shifts horizontally. That transform-to-translation trick is why log-polar is the standard tool for rotation/scale-invariant matching in classic CV - and now you can reach it from a workflow graph.
The inputs you set
- src -
NPARRAY. You know the drill by now:Image2Nparrayin,Nparrays2Imageout. - center - string literal pole:
[256, 256]or(w/2, h/2). Parsed byast.literal_eval; malformed input is the pack'sinvalid syntax (<unknown>, line 0). - M - logarithmic scale in pixels per e-fold. This is the main "feel" knob; higher
Mspreads radial detail out, lower crushes it. - flags -
1forINTER_LINEAR, plus8(WARP_FILL_OUTLIERS) if you want the corners filled instead of black.
The optional dst out-parameter is one of the pack's call-by-reference leftovers - leave it alone. Output is a single nparray; it's a float remap, so expect it to look flat/hazy until you normalize or preview via Nparrays2Image.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Restart. Or ComfyUI Manager → "opencv". Dependencies are opencv-contrib-python, numpy, torch - nothing else, no model files.
Troubleshooting
- Output is black in the corners - add flag bit
8to fill them. - Too much or too little radial detail - that's
M; tune it, there's no "right" value. invalid syntax- thecenterstring is bad. Verify brackets/parens and no stray text.- Batch error -
Only images with batch_size==1 are supported!→ImageFromBatch, length=1.
That's honestly the whole node. Don't overthink which variant to use - the pack's _0/_1 duplication is a quirk of its auto-generation, not a meaningful choice. If a foveal/vortex remap fits your workflow, logPolar_0 and logPolar_1 are the same door.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| center | STRING | — | |
| M | FLOAT | — | |
| flags | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |