Motivation
Before joining two images into a mosaic, their coordinate systems must be aligned. The existing compositing chapter distinguishes alignment from blending; here we derive a translation estimator for an idealized periodic image. A sharp correlation peak is useful only when the modeling assumptions and the sign convention are understood.
A finite periodic model
Definition 6.1.1
(Transform and translation convention)
Let be an integer. For a length- sequence , with indices modulo , define
Suppose for an integer . Thus a feature originally at index zero appears at index in . Let denote the transform of .
The periodic model wraps content across the array boundary. It is an analytical convention, not an assertion that a real cropped photograph wraps around. The same derivation extends to a rectangular two-dimensional periodic grid by applying a shift and a frequency index in each coordinate.
Shift and normalized cross-power
Theorem 6.1.2
(The peak under exact assumptions)
If for every bin, define
Then and its inverse transform is at index modulo and at every other index. This peak reports the shift of relative to in the convention above.
Proof
(Shift theorem, normalization and a geometric sum)
Substitute into the transform of . Because and are both -periodic in the index, the sum still runs over all residues, and
Therefore . Since , its magnitude is positive, and dividing by the magnitude leaves the pure phase .
The inverse transform of is
Let , so . If modulo then and the sum equals , giving . Otherwise and , giving .
Proof X-ray
Where the sign of the peak comes from
Three hypotheses are used in three different places. Periodicity is used in the substitution : it is what lets a shifted sum run over the same set of residues, so wrap-around is built into the theorem. The condition is used only when dividing by the magnitude. The identity is used only in the final geometric sum.
The non-obvious move is the normalization. The cross-power has the unknown amplitude multiplying the pure phase , and dividing it out leaves a unit-modulus exponential. The exponentials are orthogonal over a period, which is why the inverse transform of a single pure exponential is one impulse. The sign comes from the conjugate: cancels the phase of and keeps the shift phase of . Using instead conjugates and reports modulo , which is a different sign convention and not an error in the theory.
Multiplying by a positive constant leaves unchanged in this exact nonzero-bin model. This observation does not guarantee immunity to additive offsets, clipping, noise, rotation or a changed field of view. Frequency bins with zero or tiny magnitude need a declared policy: the displayed division is undefined at zero, and a noisy phase at a small magnitude may be unreliable.
A four-sample calculation
Worked example 6.1.3
(A one-sample shift)
Take , and , so . Direct computation gives
All bins are nonzero, and the normalized products are . The inverse transform is : the peak at index reports a one-sample shift under our convention. To align back to , the compensating shift has the opposite sign.
Worked example 6.1.4
(A shift of two samples)
For the same take , so . Then and . The inverse transform is , which is at and at . The peak is the unit impulse at index .
Worked example 6.1.5
(Wrap-around: three samples forward or one sample back)
For the same take . Since , we have , and . The inverse transform is , an impulse at index . On a periodic grid index is also modulo : the same is obtained by moving forward by three samples or backward by one, because the model wraps. The peak index alone cannot tell which of these two descriptions the physical motion was; the choice of the representative with smallest magnitude is an additional convention.
Common mistake
(Reading the peak with the wrong sign)
Using instead of changes the normalized spectrum to . In the one-sample example this gives and an impulse at index , which is modulo , not at index . Both computations are correct; they answer different questions, so the convention (which image is shifted relative to which) must be fixed before reading the peak.
Missing information and boundaries
Counterexample mode
An image with no identifiable shift
For , every periodic translation produces the same sequence. Its transform is , so the nonzero-bin theorem does not apply. If an implementation sets the three undefined bins of to zero and uses , the inverse is : no unique peak exists. Choosing a maximum by a tie-breaking rule would not create information about the true shift.
Repeated patterns can likewise yield multiple plausible alignments. In real images, occlusion and cropping violate the exact circular-shift model; padding or a window changes the processed data and must be analyzed rather than treated as a proof of correctness. The integer peak is a discrete estimate: subpixel fitting or interpolation needs an additional method and validation. A downstream blend cannot repair a wrong geometric match merely by hiding the seam.
Exercises
Quick check
(For and a shift , write the ideal and its inverse peak.)
Use .
Solution · Answer
; its inverse is the unit impulse at index .
Quick check
(In the worked example, which sign reports the correction needed to align back to ?)
The peak reports the shift of relative to .
Solution · Answer
is shifted by relative to , so the compensating shift is modulo , equivalently index .
Quick check
(Why is it invalid to divide by the cross-power magnitude at a zero frequency bin? What can setting it to zero fail to preserve?)
What is the value of the denominator at such a bin?
Solution · Answer
The denominator is zero, so the quotient is undefined. Setting the bin to zero removes that frequency from the inverse; the exact single-impulse conclusion may no longer hold.
Quick check
(If on a periodic length-four grid, can the data distinguish shifts and ? Explain.)
Compare with its translate by two samples.
Solution · Answer
No. A shift by two returns exactly the same sequence, so these data cannot distinguish the two shifts.
Further study
Nonperiodic registration, robust feature matching, subpixel estimators, projective motion and confidence assessment require additional analysis. This unit does not implement a registration system or certify alignment of a particular image pair.