p.coregister - Co-register two rasters by translational shift estimation.
Estimates and corrects a sub-pixel translational offset between two rasters using FFT-based phase correlation (Foroosh et al. 2002). Optionally refines the estimate with normalised cross-correlation. Both rasters must share the same location and resolution; use g.region before running to ensure alignment. Output: a registered (shifted) version of the slave raster and an optional CSV shift report (dx, dy in pixels and map units).
Refine phase-correlation peak with normalised cross-correlation (slower but more robust for noisy/low-contrast images)
-w
Do NOT apply Hann window before FFT. By default the Hann window is applied to reduce spectral leakage. Disable for images that already have smooth boundary conditions.
p.coregister co-registers two raster maps by estimating and correcting
a translational pixel shift using FFT-based phase correlation
(Foroosh et al. 2002, IEEE Trans. Image Process. 11:188-200).
Both rasters must share the same GRASS location, mapset and resolution.
Use g.region to align them before running.
Both rasters are loaded into memory and NULL cells replaced by band mean.
A 2-D Hann window is applied (unless -w is given) to reduce spectral
leakage from non-periodic boundary conditions — recommended for real
remote-sensing imagery.
Both windowed rasters are mean-subtracted and forward-FFT'd (FFTW3).
The normalised cross-power spectrum is formed:
C = S·conj(M) / |S·conj(M)|
The inverse FFT of C is the phase-correlation surface; its peak at
(dy, dx) is the translational shift of slave relative to master.
A 2-D parabolic fit around the peak gives sub-pixel precision.
Optionally (-n), a normalised cross-correlation (NCC) search over a
search= pixel window refines the estimate — useful for low-contrast
or noisy images.
The registered slave is written using bilinear interpolation.
A CSV shift report is written (or printed to stdout).
Translation only: no rotation, scale or affine correction.
Both rasters must cover the same extent and resolution (g.region first).
Phase correlation is most accurate when both images have broadband
spectral content (textured terrain, radar backscatter). For smooth
or globally periodic images, disable the Hann window (-w) and use
NCC refinement (-n).
The maximum detectable shift is rows/2 × cols/2 pixels.
For sub-pixel NCC refinement, integer-pixel accuracy from phase
correlation is used as the search centre; search= controls
the ±radius of the NCC sweep (larger = more robust, slower).
The registered slave always has NODATA margins at the shifted edges.