Skip to content

stacking multiple star photographs for noise reduction

Notifications You must be signed in to change notification settings

bkarwoski/StarStack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StarStack

This simple python script allows users to combine a large number of photos of the night sky, without the need for equatorial tracking equipment. By combining many short exposures together, background noise can be reduced, giving the effect of a single, longer exposure.

Before and after (no post-processing): (100% zoom, left is a 5 second exposure, 50 mm F/1.8 lens on a Sony Alpha 7 ii. Right is 120 exposures stacked.) before and after image stacking

Theory

Due to its low light output, the night sky requires very long image exposure times to collect sufficient light. Unfortunately, trying to take one long exposure leads to star "trails" forming, due to the Earth's rotation. Long exposures also lead to increasing buildup of light pollution, washing out less prominent stars.

Registration

The homography is found using the Enhanced Correlation Coefficient algorithm, which is implemented in OpenCV. This method works well for the small change between each frame, because the previous frame's orientation can be given as an initial "guess."

Light Pollution Subtraction

Most urban and suburban areas are subject to significant light pollution, making imaging faint night sky objects challenging. Fortunately, this light pollution tends to vary gradually and smoothly across the sky. A common technique to remove this pollution is to take a gaussian blur of the sky, and then subtract this image from the original. Gaussian blur of the image, with stars subtracted

Challenges

The most difficult part of this project was selecting the best algorithm to align exposures between successive exposures. I initially tried using iterative closest point, which finds the alignment between two sets of points, not knowing how each point in the first set corresponds to that in the second set. I generated the 'points' for each frame as the brightest stars. I used a technique described in Astromtery.net: subtract the median pixel value from the image, and then look for the statistical outliers in the image, which correspond to pixels belonging to stars.

Results

This gif shows a 100% crop of the center 200 x 300 pixels of the stacked image. As the number of frames averaged together increases, the noisiness of the background visibly decreases. gif showing noise reduction

Usage Directions

Place desired images to be stacked in a folder in the same directory as stack.py, labeled "jpg". Run stack.py. The image registration will take roughly 30 seconds per image.

Future Work

The enhanced correlation coefficient (ECC) alignment step is the most expensive step in processing the images. It would be interesting to see how many iterations, or what error threshold epsilon, consistently leads to satisfactory stacking results.

The ECC process is also sequential. Each frame's transform (to the base frame) needs the previous frame's prior transform as a prior estimate, or the ECC process won't arrive at a good pose estimate. This means it cannot be readily parallelized. I may try to modify this process such that the stack is broken into parts and given to different threads.

About

stacking multiple star photographs for noise reduction

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages