ECC alignment
Refine a warp by maximizing enhanced correlation between an image and a template.
Compare the same structure before and after a coordinate transformation.
Warp the current image using an initial transform.
Measure normalized photometric agreement and its local gradient.
The mint structure now coincides with the reference in this illustrative convergence. Real alignment can stop at a local optimum.
Update the warp parameters until the stopping criterion is met.
Illustrative example. The stages explain the method; they are not a live OpenCV execution.
Try it on an image
Experiment at pixel level
Align the second grayscale image to the first using iterative correlation. Small overlap or unrelated photos may not converge.
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
Track a roughly aligned patch or improve an initial translation, affine transform or homography.
How it works
- 01Warp the current image using an initial transform.
- 02Measure normalized photometric agreement and its local gradient.
- 03Update the warp parameters until the stopping criterion is met.
iterate warp parameters to increase normalized correlation
What to tune
motionType controls the model; criteria sets iteration and accuracy limits; a mask excludes unsuitable template pixels.
Where it breaks down
This is a local optimizer. Large displacements, occlusion or a poor initial warp can cause failure to converge.
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
Template matching
Slide a patch across an image and score how well it agrees at each location.
Phase correlation
Estimate translation from the phase relationship between two images in the frequency domain.
Brute-force descriptor matching
Compare each query descriptor with every training descriptor using a chosen distance.
FLANN nearest neighbours
Organize descriptors so nearest-neighbour queries can avoid an exhaustive scan.