CV Polar To Points
Bearings back into pixels
- radius
- angle
- points
- count
The inverse of CV Points To Polar, and the half you actually need to draw anything. Push a radius and an angle in, get a pixel back.
What it's for
Two jobs, both about making a measurement visible again. The first is rendering: you measured that a clock hand points at 137 degrees and reaches 180 pixels, and now you want to put a marker on the end of that hand, or draw the segment from the centre. Polar is a nice coordinate system to think in and a terrible one to draw in. Convert, then hand the pixels to CV Draw Points, CV Draw Circles or CV Draw Segments.
The second job is generating geometry. Place N markers evenly around a circle, put labels on a radial scale, lay out a clock's twelve tick marks - all of that is a radius array and an angle array away, and it's far less tedious than typing coordinates into CV Points by hand. Because a single-element radius broadcasts against an N-element angle array (and vice versa), you can write one angle list and one radius value and get a full ring out of it.
How it works
For each pair it builds the point at that distance and bearing around origin_x/origin_y, in the convention you select - the same two options as the forward node, clockwise from 12 o'clock or counter-clockwise from +x (math). That convention is not decoration: it's the difference between your reconstructed point landing at three o'clock and it landing at nine.
Empty inputs give zero points rather than an error, which keeps a graph alive on frames where a detector found nothing.
Inputs and outputs
radius is an (N,) distance array, angle is an (N,) array in degrees, and the two must line up by index - element i of radius pairs with element i of angle. origin_x and origin_y are pixel coordinates of the reference centre, and they default to (0,0), so set them. angle_convention must match whatever produced the angles.
The points output is Nx1x2 float32 image coordinates, in the same order your radius/angle arrays came in, and count tells you how many points came out. Wire points into any drawing node, or into CV Sample Array At Points if you want to read a value at each reconstructed position.
Installing
Same as everything in this pack. ComfyUI Manager → search "ComfyUI CV", or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
# restart ComfyUI
Requires Python ≥ 3.12 and a recent ComfyUI on the V3 node API. The pack's dependency set is small and real: opencv-contrib-python-headless~=5.0.0.93, numpy, torch. Nothing to download for this node.
Gotchas
Convention drift. Round-tripping through CV Points To Polar and back only works if both nodes agree on the convention. Mix them and the points mirror - the radius is right and the bearing is wrong, which is a genuinely confusing failure because half the output looks correct.
The length mismatch. radius and angle are paired by index, so an angle array of 12 values against a radius array of 3 gives you three points, not twelve. If your ring comes out short, one input is shorter than you thought.
Origin again. (0,0) is the image corner. Every reconstructed point will be off by however far your real centre is from it, in the same direction.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| radius | NPARRAY | (N,) distances from the origin. | |
| angle | NPARRAY | (N,) angles in degrees. | |
| origin_x | FLOAT | 0.00-1000000–1000000 | X pixel coordinate of the reference origin (e.g. the dial center, anchor, or ray start). |
| origin_y | FLOAT | 0.00-1000000–1000000 | Y pixel coordinate of the reference origin (e.g. the dial center, anchor, or ray start). |
| angle_convention | COMBO | clockwise from 12 o'clock (clock) | Must match the convention the angles were measured in. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| points | NPARRAY | Nx1x2 float32 image coordinates. |
| count | INT | — |