shinestacker

Alignment and registration

Automatically align, scale, tanslate and rotate or apply full perspective correction.

All constants described below are contained in the object constants, imported as:

from shinestacker.config.constants import constants

Alignment actions can be added to a job as follows:

job.add_action(Actions("align", [AlignFrames(*options)])

Arguments for the constructor AlignFrames of are:

matching_config (optional, default; None): a dictionary specifying the following parameters, with the corresponding default values:

matching_config= {
    'match_method': constants.MATCHING_KNN,
    'flann_idx_kdtree': 2,
    'flann_trees': 5,
    'flann_checks': 50,
    'threshold': 0.75
}

Automatic fallback

Some detector/descriptor combinations — most notably ORB/ORB, which is the default — can occasionally fail to find enough matches, or to estimate a reliable transformation. When this happens, alignment is automatically retried with a more robust configuration (SIFT/SIFT with KNN matching). The fallback is built into the code: it is not configurable and it is not exposed in the GUI.

A fallback attempt is logged as a warning for the affected frame.

If plot_matches is enabled, the match plot of the fallback attempt is saved with a -fb-sift suffix (e.g. align-matches-0042-fb-sift.png), alongside the plot of the primary attempt.

If the fallback also fails, the frame is handled as usual: it is skipped, or recovered by phase correlation if phase_corr_fallback is enabled. No success/failure message is emitted for the fallback itself: the existing warnings cover both cases.

Parallel processing

A class AlignFramesParallel implements alignment using parallel processing. This class has extra parameters, in addition to the above ones:

Automatic selection of processing strategy

A class AlignFramesAuto implements alignment with either sequential or parallel processing, and automatically tunes parallel processing parameters. This class has extra parameters, in addition to the above ones:

Allowed configurations

⚠️ Not all combinations of detector, descriptor and match methods are allowed. Combinations that are not allowed give raise to an exception. This is automatically prevented if one works with the GUI, but may occur when using python scripting. Below the table of the allowed combination with a comparison of CPU performances.

CPU performances

⏳ Below the time performances for alignment of two of the sample images with 2000×1300 resolution for allowed configuration combinations, from fastest to slowest. Note that slower may be more precise.

Time (s) Detector Descriptor Match method
0.0250 SURF ORB NORM_HAMMING
0.0347 SURF BRISK NORM_HAMMING
0.0469 ORB ORB NORM_HAMMING
0.0471 ORB BRISK NORM_HAMMING
0.1001 BRISK BRISK NORM_HAMMING
0.1199 BRISK ORB NORM_HAMMING
0.1604 SURF SIFT KNN
0.1966 BRISK SIFT KNN
0.2121 ORB SIFT KNN
0.2738 AKAZE AKAZE NORM_HAMMING
0.2863 AKAZE ORB NORM_HAMMING
0.2887 AKAZE BRISK NORM_HAMMING
0.4075 AKAZE SIFT KNN
0.4397 SIFT SIFT KNN

References

For a detailed review of the various image registration methods, see the publication below: