Skip to content

Phase correlation

Estimate translation from the phase relationship between two images in the frequency domain.

Try it on your image ↓

VISUAL WALKTHROUGHMatching
REFERENCE INPUTTwo shifted signals

Orange is shifted seven samples relative to violet.

RESULTLocate the correlation peak

The ideal inverse transform concentrates the response at the displacement. Real images produce a broader, noisy peak.

STEP 03 / 03

Transform back and locate the correlation peak.

Illustrative example. The stages explain the method; they are not a live OpenCV execution.

Try it on an image

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

Estimate a global translation between grayscale images, then align the second image to the first.

The engine loads on your first run. Your images stay in this browser.

Input448 × 320
OutputWaiting for a result

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
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Measure global image shifts, stabilize a translating scene, or compare log-polar representations.

How it works

  1. 01Transform both images into the frequency domain.
  2. 02Normalize their cross-power spectrum.
  3. 03Transform back and locate the correlation peak.

R = (F1 · conjugate(F2)) / |F1 · conjugate(F2)|

What to tune

Use matching single-channel float images. The response score measures peak concentration and should be checked alongside the shift.

Where it breaks down

Changing content, occlusion and periodic texture weaken the estimate. Windowing helps reduce discontinuities at the image boundary.

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.