Image registration with subpixel precision using an upsampled discrete Fourier transform cross-correlation. This uses an efficient matrix-multiplication algorithm for upsampling the cross-correlation following Guizar-Sicairos, Thurman, and Fienup (2008).1
julia>] add SubpixelRegistration
First, import the package
julia> using SubpixelRegistration
now, let's load two images we wish to register
julia> source, target = # ...
we can use phase_offset
directly to perform the DFT-upsampling cross-correlation analysis
julia> phase_offset(source, target; upsample_factor=1)
(shift = (-22.0, 13.0), error = 0.9999999999214572, phasediff = 0.0)
julia> phase_offset(source, target; upsample_factor=4)
(shift = (-22.5, 13.25), error = -11.584699520819848, phasediff = 0.0)
the register
and coregister
methods directly manipulate images (or stacks of images) using this phase offset method
julia> register(source, target; upsample_factor=100);
julia> coregister(cube; dims=3, refidx=1, upsample_factor=100);
If you would like to contribute, feel free to open a pull request. If you want to discuss something before contributing, head over to discussions and join or open a new topic. If you're having problems with something, please open an issue.
Footnotes
-
Manuel Guizar-Sicairos, Samuel T. Thurman, and James R. Fienup, "Efficient subpixel image registration algorithms," Opt. Lett. 33, 156-158 (2008) ↩