Nodes/comfyui_bmad_nodes/RemapWarpPolar
ComfyUI Node Runs on cloud

RemapWarpPolar

RemapWarpPolar for watch faces, dials and iris shots

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
RemapWarpPolar
    • REMAP
    max_radiushalf min shape
    radius_adjust1.00
    center_x_adjust0.00
    center_y_adjust0.00
    logfalse
    inversetrue
    croptrue

    If you've ever wanted to read text printed around a circle - a clock face, a coin, a ring, a round logo - you know the pain of doing it in straight pixel space. RemapWarpPolar is the node that unrolls that circle into a rectangle so the text sits on a flat line, and it's one of the more immediately impressive tricks in the bmad nodes pack. It's OpenCV's warpPolar under the hood, and honestly it's the kind of thing you didn't know you needed until you try to OCR a dial and get garbage.

    One thing to get straight first: this node doesn't touch a single pixel. Like every node in the pack's Remap family, it just computes the mapping and hands you a REMAP object. You wire that into the companion Remap node, plug your image into src, and that's where the actual warp happens. It's a two-hop setup, but it's also why the same Remap node can apply barrel distortion, pinch, cylinder, and a dozen other warps without re-implementing anything.

    How it works

    cv.warpPolar reshapes the image between Cartesian and polar coordinates, with an optional log-polar mode. max_radius decides how the radius of that mapping relates to your image size: half min shape and half max shape use half the smaller or larger dimension, hypot uses the corner distance (the circle that just touches all four corners), and raw lets radius_adjust act as an absolute radius instead of a scale. center_x_adjust and center_y_adjust nudge the center point as a fraction of the image size, handy when your subject isn't dead center.

    The three toggles are where people get confused, so here's the quick version:

    • inverse flips the map direction. It defaults to true, which wraps an unrolled strip into a circle. Uncheck it to unroll a circular region into a rectangle. If your output looks like the inside-out version of what you wanted, this is the switch.
    • log swaps linear for log-polar. Use it for scale/rotation-invariant matching - a log-polar image of the same feature looks identical after scaling, which is the classic trick for finding a logo or mark at unknown size.
    • crop trims the result to the circle's bounding box so you don't get the empty corners. Keep it on unless you need the full frame.

    Wiring it

    Inputs: max_radius, radius_adjust, center_x_adjust, center_y_adjust, log, inverse, crop. Output: one REMAP. From there:

    RemapWarpPolar (REMAP) → Remap node (remap input)
    Your image        → Remap node (src input)
    

    The Remap node also takes an optional src_mask and an interpolation choice, and returns both a warped IMAGE and a MASK. If you set output_with_alpha, you get the mask packed into the alpha channel - useful for compositing the unrolled region back over something.

    Installing

    RemapWarpPolar ships in comfyui_bmad_nodes, bmad4ever's grab-bag of API, computer-vision, and general-utility nodes. Easiest is ComfyUI Manager - search "comfyui_bmad_nodes" (or "Bmad Nodes"), install, restart. Manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmad4ever/comfyui_bmad_nodes
    cd comfyui_bmad_nodes
    pip install -r requirements.txt
    

    Then restart ComfyUI. No model downloads - it's all code. The CV half of the pack needs opencv-python (pinned to ~4.8 in the requirements), and if your startup log says "Not loaded: CV nodes," that's the missing dependency biting you. The pack also warns if your ComfyUI is too old to support the extension system, so keep ComfyUI current.

    One honest caveat: there's very little community discussion of this exact node - it's a niche tool in a niche pack. But the math is plain OpenCV, and once you've got the inverse toggle figured out it's remarkably reliable. My one tip: start with the default radius modes, and treat radius_adjust as your fine-tune dial for fitting the circle to your subject.

    CategoryBmad/CV/Transform

    Inputs (7)

    NameTypeDefaultDescription
    max_radiusCOMBOhalf min shape4 options: half min shape, half max shape, hypot, raw
    radius_adjustFLOAT1.000.1–2048
    center_x_adjustFLOAT0.00-3–3
    center_y_adjustFLOAT0.00-3–3
    logBOOLEANfalse
    inverseBOOLEANtrue
    cropBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    REMAPREMAP