This script adds diffraction spikes to stars in astrophotography images.
This script only processes TIFF input images and only processes TIFF output images.
Add an image to be processed and provide an output file name.
If you like this software and would like to help support development and maintenance of this project, please consider buying me a coffee
Computer running at least Python 3.11 with tkinter support
% brew install python-tk
For Windows installation, please refer to the Python page: https://www.python.org/downloads/windows/
For other platforms: https://www.python.org/download/other/
tkinter: If you are using Homebrew (otherwise tkinter is a standard python lib): % brew install python-tk
cv2: % pip3 install opencv-python
numpy: % pip3 install numpy
Pillow: % pip3 install Pillow
Download the zip file for this script or check out the project with git.
Un-archive the zip file into a directory of your choice
Assuming your python installation is run using python3
, issue the following command from within the directory you installed the script. How you run python is dependent upon your platform and installation. For example on Mac with Homebrew installed Python 3, your python command may be python3
. On other platforms it may just be python
.
% python3 AF_diffraction_spikes_gui.py
Select your input file (to be processed) and processed output file name. For processed output file you can also choose an existing file. This is convenient when you are working with an image and testing configuration changes to the same output file. When choosing an existing output file, the file will be overwritten upon each processing run.
Within the AF Diffraction Spikes GUI you will find a series of numeric sliders which are used for assigning parameter vaules for specific calculations. Please hover over each information icon ( i ) next to the control label for more information on each parameter.
- Set Minium Threshold: This value sets the lower limit for pixel intensity. Pixels with intensity values below this threshold are considered part of the background and are not classified as stars.
- Set Maximum Threshold: This value sets the upper limit for pixel intensity. Pixels with intensity values above this threshold are considered potential stars.
- Set Spike Length Multiplier: Adjust the length of the diffraction spikes.
- Set Spike Thickness Multiplier: Adjust the thickness of the diffraction spikes.
- Set Blur Kernel Size: Set the size of the blur kernel applied to the spikes.
- Set Blur Multiplier: Adjust the intensity of the blur applied to the spikes.
- Set Rotation Angle: Set the rotation angle for the diffraction spikes.
- Process and Generate Image: Clicking this button will process and generate an image with diffraction spike configurations applied.
- Preview Images: The left preview is gthe original image entered into the input image selection. The right preview image is the result of processing diffraction spikes. Note You may click on the output image preview to view a larger image.
AF Diffraction Spikes configuration can take a lot of trial and error. Every image is different and requires unique sets of paramegters. So, with that said, there is no one right way. Work with the sliders and experiment. Preview your output image as often as you like, it is created nearly instantaneously.
AF Diffraction Spikes written by: Douglas Reynolds
doug [at] astroaf [dot] space