A package for aligning and comparing astronomical images
Project description
StarsAlign - A package for aligning and comparing high density astronomical images with extreme precision
StarsAlign is a package for aligning and comparing astronomical images using the SIFT algorithm and FLANN based matcher.
It contains functions such as align()
and diff()
that aligns and compute the difference of two single channel images.
The package also contains ultra_align()
and ultra_diff()
functions for extreme precision, but they may require more resources.
Examples of this package usage can be found inside the folder examples: https://github.com/nagonzalezf/starsalign/tree/main/examples
The lastest package version is 1.0.10
.
Reference Image | Science Image | Raw Difference Image |
---|---|---|
Reference Image | Aligned Science Image | Aligned Difference Image |
---|---|---|
Important
This package was specifically designed to work with images that have a high amount of information, such as 4096x2048 pixels, with float32 data type, and a range of values between -155.45811 and 43314.49.
It is recommended to use the ultra_align()
and ultra_diff()
functions on lower resolution or lower density images, but it may result in prolonged waiting times.
Installation
Using pip:
pip install starsalign
Using setup.py
file from root directory
python setup.py install
Usage examples
Getting the aligned science image using align()
function (faster method)
>>> import starsalign as stal
>>> aligned_image = stal.align(ref_image, science_image)
Getting the aligned science image with a more precise alignment using ultra_align()
function (slower but more precise)
>>> import starsalign as stal
>>> aligned_image = stal.ultra_align(ref_image, science_image)
Supported input formats
By default the package is intended to be use over float 32 single channel images of wide range, but it can also process other formats such as uint8 images or even binary images.
The align()
and diff()
functions will only support single channel images.
If you want to process multi channel images you have two options:
-
You can use the
ultra_align()
andultra_diff()
functions, these will automatically get rid of the multi channels and perform the calculations over buffer single channel images to finally process and extract the original multi channel images as output. -
You can get rid of the extra channels yourself performing some pre-processing tasks such as opencv
cvtColor()
andCOLOR_BGR2GRAY
functions or similar methods and then process the images using the defaultalign()
anddiff()
starsalign functions.
Difference Image Analysis (DIA) application examples
The main idea behind this technique is to subtract two images of the same portion of the sky, removing all photometrically stable stars, but tipically this images are not aligned by default.
Example 1 - diff()
function
For this example we will use some float32 images of the NGC6569 globular cluster in the constellation Sagittarius.
Reference Image | Science Image | Raw Difference Image |
---|---|---|
As you can see the reference and science images are not aligned, so the raw difference results are incorrect.
We process the image using diff()
function (faster method):
>>> import starsalign as stal
>>> aligned_image = stal.diff(ref_image, science_image)
And we get a desired difference result:
Reference Image | Aligned Science Image | Difference Image |
---|---|---|
Documentation
Documentation is under construction, in the meantime you can check:
SIFT algorithm docs at: https://docs.opencv.org/4.x/da/df5/tutorial_py_sift_intro.html
FLANN feature matcher docs at: https://docs.opencv.org/4.x/d5/d6f/tutorial_feature_flann_matcher.html
Wich are the key methods applied.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for starsalign-1.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 388a423888f9e3ec132b5a3bc0d05ff4b9e85cf99e19422fcdbe7bb1d07dc816 |
|
MD5 | dfef502dd0cf842efff7c393919254c2 |
|
BLAKE2b-256 | 8b2f2419cf758c0bc68f9f8c9fcd40395574d300790dffdc4a5af999699d33b7 |