Ma(e)stroStack: align and stack images (class)

Ma(e)stroStack: a Matlab class to automatically align and stack astro-photography images
240 Downloads
Updated 22 Jul 2020

mastrostack: a class to automatically align and stack astro-photography images

This class gets a list of images, and automatically determines bright stars as control points. These are followed along pictures, and used to build an affine transformation at constant scale (e.g. a rotation and translation). All images are then stacked. The images can be given as file names (may include wildcards), or matrices from e.g. imread, and support both RGB and gray images. As stars are used for the alignment, this method is suited for deep sky images, but not for planetary imaging.

Syntax
ma = mastrostack;
start the user interface, without loading images (can be done afterwards)
ma = mastrostack(light, dark, flat)
loads light, dark (background) and flat (scope response) images, and label them.

Importing images

Start with: ma=mastrostack;

Then press the Return key on the main interface. A Drop Files Here button appears in the lower left side. Drag and drop your Dark, Flat and Light images there. Images having 'dark' or 'flat' in their path/file name are marked as such automatically. You may alternatively use the File menu items.

Supported image formats include JPG, PNG, TIFF, FITS. If you have installed readraw, you may as well directly import RAW camera images. This is highly recommended, as it retains much more information from the camera shot than the generated JPEG images, which prooves to be essential for subtracting the Dark image (background), and revealing faint objects.

Preparing the Stacking

After importing the files, you should label them using the 'Image/Mark as...' menu items. You can navigate within images with the Image/Goto menu item, and the arrow keys, or the mouse wheel. 'Bad' images can be skipped (ignored). To use them back, set their type to 'light'. You should then compute the master Dark and Flat images (Compute menu).

It is recommended to zoom onto specific features (e.g. a set of stars) to check visually for their sharpness. Deselect the Zoom tool, and scan through images using the left arrow key, and press the 'I' key to mark images to be ignored, such as those blurred. To reset the plot, press the Return key.

You can select the Reference image, which will be used as template for stacking. If not defined, the first image in the list will be used as such when stacking.

Stacking

When ready, use the Compute/Stack menu item. If the Alignment has not been executed previously, it is achieved for each image. The final image is then shown and written to disk. Use e.g. Lightroom, RawTherapee, DarkTable to enhance contrast.

Notes

If you have difficulties in stacking (some images do not have enough control points), relax e.g. the translation tolerance, using the menu item 'Compute/Set tolerances'. You can also increase the number of control points. In case the main interface is closed, get it back with: plot(ma)

Using commands (scripting)

% create Ma(e)stroStack and import images
ma=mastrostack('path/to/images/*.JPG','path/to/darks/*.JPG','path/to/flats/*.JPG'); % stack. The first 'light' image will be used as Reference for stacking
stack(ma);

(c) E. Farhi, 2018. GPL2.

More at <https://github.com/farhi/matlab-mastrostack>
See also: <https://fr.mathworks.com/matlabcentral/fileexchange/66927-read-raw-camera-images>

Cite As

Emmanuel Farhi (2024). Ma(e)stroStack: align and stack images (class) (https://github.com/farhi/matlab-mastrostack), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Versions that use the GitHub default branch cannot be downloaded

Version Published Release Notes
18.810

correct method now removes hot spots (dead pixels)

1.0.4.0

Compatibility with Matlab > 2014b. Fix for hot/dead pixels and peak width.

1.0.3.0

Compatibility for Matlab > 2014b

1.0.2.0

much faster initial import. Improved sharpness selection tool.

1.0.1.0

added icon/image

1.0.0.0

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.