Registration: lining frames up
Between frames the telescope drifts, and on an alt-az mount like the Origin the field also slowly rotates around the target as it crosses the sky. Before frames can be combined, each one's offset and rotation must be known to a small fraction of a pixel.
- A coarse shift first
pyramid + phase correlation The offset between two images shows up as a peak in their cross-correlation. Computing that with Fourier transforms (phase correlation) finds the shift for the whole image at once. OriginStack does it coarse to fine: on a half-resolution copy to find the rough offset, then at full resolution only in a small window around it, then to sub-pixel precision by fitting a curve through the peak.
- Then rotation, from star patterns
star matching + RANSAC A shift alone cannot describe a rotated field. The stars of each frame are matched to those of the reference, and a rotation plus translation is fitted to the matched pairs. Some matches are always wrong, so the fit uses RANSAC: fit to a few random pairs, count how many other pairs agree, repeat, and keep the fit that most pairs agree with. The final fit uses all the agreeing pairs with the closed-form least-squares solution of Umeyama. The random sampling uses a fixed seed, so the same frames always give the same result.
- When the rotation is unknown
blind pattern match For frames where the simple shift came out as nonsense, and for stacks from different nights, nothing is known about the rotation. The trick: the distance between two stars does not change when the field rotates or shifts. Pairs of stars with matching distances in both images are candidate matches; candidates that agree on one rotation angle are the real ones. Because both images come from the same camera, the scale is exactly 1, which removes one unknown.
On a real Fireworks Galaxy session, 34 of 148 frames needed this rescue. Before, they were stacked in the wrong place.
- Checking the answer
residual gate After alignment, star positions are measured again on a sample of frames. A frame whose stars still land too far from the reference is dropped. The limit adapts to the session, so one wrongly set threshold cannot throw away a whole night. The reference frame itself is chosen from the middle of the session in time, which keeps the area common to all frames as large as possible.
- Resampling
Lanczos-3 Moving an image by a fraction of a pixel means computing new pixel values between the old ones. OriginStack uses a Lanczos-3 kernel, a windowed sinc that keeps fine detail far better than bilinear interpolation. Each frame is warped once, with the shift and rotation combined into a single resampling step, so it is never blurred twice.
Further reading
- Guizar-Sicairos, M., Thurman, S. T. & Fienup, J. R. (2008). Efficient subpixel image registration algorithms. Optics Letters 33, 156–158.
- Fischler, M. A. & Bolles, R. C. (1981). Random sample consensus. Communications of the ACM 24, 381–395.
- Umeyama, S. (1991). Least-squares estimation of transformation parameters between two point patterns. IEEE Trans. PAMI 13, 376–380.
