An astrophotography stacking program that leverages parallel GPU computing through CUDA C to accelerate processing.
The program was developed to perform stacking of FITS images using the Alpha-Sigma algorithm, with the goal of improving the quality of the final image by enhancing the signal of the photographed object and reducing the noise present in the individual shots. Thanks to these features, it is particularly useful in astrophotography and astronomical image processing, where numerous acquisitions of the same subject affected by different levels of noise and disturbance are available.
orionStacker/
├── .devcontainer/ # Configuration for container-based development (Dockerfile)
├── src/ # Main source code
│ ├── calibration/ # Image calibration (host/CPU and device/CUDA versions)
│ ├── common/ # Shared utilities: FITS file handling, CUDA helpers
│ ├── debayer/ # Image debayering (MHC filters)
│ ├── gui/ # Application graphical interface
│ ├── stacker/ # Implementation of the Alpha-Sigma stacking algorithm
│ ├── star_finder/ # Star detection (thresholding, Otsu, warp, descriptors)
│ └── utils/ # Small command-line tools (e.g. FITS metadata reading, result verification)
├── test/ # Tests and benchmarks for the various modules (stacker, star finder, calibration, debayer, aligner)
├── third_party/ # External dependencies (e.g. ADE, OpenCV) included as submodules, with build scripts
├── CMakeLists.txt # Main configuration for building with CMake
└── README.md
The project mainly handles calibration of frames obtained directly from the astro camera, debayering of the calibrated light frames, alignment through star detection in the images, and finally stacking of the final result.
- Input format: 16-bit unsigned FIT images.
- Output format: 16-bit unsigned FIT images.
More format will be supported in the future.
Required frame types:
- Bias frames: used to compute the master bias (average of the bias frames)
- Dark frames: used to compute the master dark
- Flat frames: used to compute the master flat
- Light frames: corrected using the master bias, master dark, and master flat
Required dependencies: the project uses CMake + OpenCV + cfitsio
sudo apt update
sudo apt install -y build-essential cmake libcfitsio-dev libopencv-devOther dependencies: cuda is not strictly needed but necessary for gpu-accelerated code and for all test files. If cuda is detected, the project will automatically build with cuda support
Build with CMake
git clone --branch dev https://github.com/albe873/orionStacker.git
cd orionStacker
mkdir build && cd build
cmake ..
cmake --build . -j$(nproc)ROCM support: is it possible to build the project with rocm. We suggest to use the devcontainer as the simplest solution to have all dependencies.
In the container execute:
mkdir build && cd build
cmake -DROCM=ON ..
cmake --build . -j$(nproc)Running the various components
cd orionStacker/build/testCudaCalibration
./cudaCalibration --light /path/light/ --bias /path/bias/ --dark /path/dark/ --flat /path/flat/ --output /path/output/or
./cudaCalibration --base-dir /path/ --output /path/output/CudaDebayering
./cudaDebayerTest --input /path/raw_bayer/ --output /path/output/CudaAlligner
./cudaAligner --input-file1 /path/img1.fits --input-file2 /path/img2.fits --descriptor-neighbors 2CudaStackerAlfaSigma
./cudaStackerAlfaSigma --input-directory /path/calibrated_lights/ --output-directory /path/output/ --file-name stack --kappa 3.0 --iterations 5CudaStarFinder
./cudaStarFinder --input-file /path/image.fits --threshold-algorithm adaptive --window-size 201 --max-star-size 100 --min-star-size 4Full run
./testAll --light /path/light/ --bias /path/bias/ --dark /path/dark/ --flat /path/flat/ --output /path/output/or
./testAll --base-dir /path/ --output /path/output/Work in progress: the pipeline is already active, the GUI is catching up.
- Input calibration frames and light frames
- Calibration of the light frames
- Debayering
- Alignment of calibrated light frames
- Stacking of calibrated light frames
