Polar and log-polar warps
Re-express an image using angle and radius around a chosen centre.
A bright sector occupies a range of angles and radii around the selected centre.
Radius is measured from the centre; angle specifies a ray through that centre.
Output rows sample different angles. Columns follow radius, or log radius for the logarithmic mode.
The sector crosses angle zero, so its unwrapped samples appear at both ends of the angle axis. A rotation becomes a shift along that axis.
Sample the corresponding Cartesian coordinate in the source.
Illustrative example. The stages explain the method; they are not a live OpenCV execution.
Try it on an image
Experiment at pixel level
Unroll distances and angles around the image centre. The output coordinate system is polar.
The engine loads on your first run. Your images stay in this browser.
Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.
Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Select a pixel
Select a pixel
When to use it
Turn rotation into a shift and, with logarithmic radius, scale change into another shift.
How it works
- 01Choose the common centre of the transformation.
- 02Map each output row to an angle and each column to a radius.
- 03Sample the corresponding Cartesian coordinate in the source.
x = cx + r cos θ; y = cy + r sin θ
What to tune
WARP_POLAR_LOG uses log radius; maxRadius and dsize set the covered region and sampling density.
Where it breaks down
The centre must be meaningful and stable. Sampling near the centre and the angular seam can distort detail.
TypeScript API
Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.
All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.
Related methods
Image resizing
Sample the source on a new pixel grid at a different resolution.
Arbitrary remapping
Provide a source coordinate for every destination pixel.
Affine transformations
Map points with a linear transform plus translation, preserving straight lines and parallelism.
Homography and RANSAC
Estimate a projective mapping between two views of a plane, rejecting inconsistent point matches.