Live Stacking

Live stacking is a feature that enables the capture of deep sky images within SharpCap without the traditional requirements of a high accuracy, guided, equatorial mount and long sub-frame exposures.  The capture of a larger number of shorter exposures and software correction within SharpCap for any drift or rotation of the field of view between frames makes deep sky astrophotography accessible to a much wider audience at much lower cost.

The traditional requirements of long exposures and accurately guided mounts arise from traditional CCD cameras used for deep sky astrophotography have a high-level of read noise.  If there is a high read noise every time that a frame is captured, long exposures are required to allow faint deep sky objects to be seen above the read noise level.  Long exposures mean that an equatorial mount which tracks accurately and is typically auto-guided is required.

This all changes when modern low noise CMOS cameras are used instead of CCD cameras.  The low level of read noise means that faint objects can be detected in far shorter exposures (and can be enhanced by stacking many short exposures – something that would not be possible without low read noise).  If exposures are short enough (often 30s or less), mount accuracy is less important as the amount of drift during a 30s exposure is far smaller than the drift during a 300s exposure.  Away from the zenith, field rotation due to the use of an ALT/AZ mount is also not usually going to be significant during a single 30s exposure. SharpCap corrects for any gradual drift or rotation between successive frames by tracking the movement of the brightest stars in the image.  As the number of frames captured increases the noise level visible initially visible in the stacked image will reduce giving astounding deep sky images with the minimum of fuss.

Because of the simple satisfaction of watching deep sky images appear in real time without the need to use a separate stacking program, Live Stacking is particularly well suited to outreach uses.

Live Stacking is started by choosing the ‘Live Stack’ option from the Tools menu or by selecting the Live Stack toolbar button.

Once selected, Live Stacking will immediately begin capturing, aligning and stacking frames.  A minimum of 3 stars must be detected in each frame for alignment to be possible (see the following sections for further details on alignment and how to customize star detection).  It is possible to save the stacked image at any point using the Save button that appears in the Live Stack work area – the Save can be repeated as required – for instance after 50 frames and again after 100 frames and so on.

The Live Stacking User Interface

The UI to control Live Stacking appears in the work area below the camera image, and is divided into an always visible left panel and a series of tabs to the right.

The left panel controls and reports on the most important aspects of the stacking process and is always visible during Live Stack.  The right panel has six tabs to allow the monitoring and control of the details of the Live Stack process.

image

Left Panel

image

Overview Group

·         Frames Stacked – the current number of frames on the stack.

·         Frames Ignored – the number of frames ignored (not stacked).  This can happen because of alignment problems, SharpCap not seeing enough stars, frame failing to achieve a focus score criteria or other reasons.

·         Total Exposure – the length of time the current stack has been running.  Some cameras cannot report their exposure value to SharpCap (for instance DirectShow Frame Grabbers).  In those cases, SharpCap estimates the exposure based on the time between subsequent frames.

Controls Group

·         Align Frames – turn alignment and de-rotation on/off (default on).  See Alignment tab on right panel for more details.

·         Enable FWHM Filter – enable/disable filtering of each frame by the average FWHM (focus quality) value.  High FWHM value frames are discarded as indicating poor focus/seeing/transparency/cloud.  See Filter tab.

·         Subtract a Dark Frame [only available for DirectShow cameras – other cameras can subtract a dark frame in the camera control panel].

·         AutoSave – enable/disable saving the stack automatically when the clear button is pressed or another action causes the stack to be reset.

·         Save Individual Frames – when enabled save each frame as a separate file (FITS/PNG).  Note, all frames are saved, not just ones passing the filtering criteria.  The individual frames will be found in a folder like YYYY-MM-DD\Capture\HH_MM_SS\rawframes.

In the Show group, there is a choice to display either the stacked image or the individual frames being acquired from the camera.

·         Stack (show the stack so far – the default)

·         Individual Frames (show the individual frames being captured by the camera)

The Clear button will reset the stack to start from scratch.  Note, other actions can cause the stack to be reset; for instance, changing camera, resolution, colour space.  Changes to exposure, gain, brightness or applying a dark/flat will not cause the stack to be reset.

The Save button has 3 sub options:

image

·         Save as 16 Bit Stack will rescale the stacked data linearly between the 0 and the maximum pixel value into the range 0 to 65535 and save this as a 16 bit FITS file.  The 16-bit FITS option is the default as it gives a high bit depth image with the full range of the image used (i.e. brightest pixel is 65535).

·         Save as Raw (32-bit) Stack will save the full 32-bit stack data without any scaling as a 32-bit FITS file.  The maximum value in it will depend on the number of frames stacked, meaning more adjustments will be needed when viewing (without further adjustment this FITS file will probably appear black when opened into a FITS viewing application).

·         Save as Viewed will save the image as seen on screen (i.e. after histogram adjustments have been applied) as an 8 or 16 bit PNG file (depending on bit depth of camera being used).

The Pause/Resume button will temporarily stop or resume stacking.  Stacking will automatically be paused if the Live Stack window is closed or if the user switches to another tool such as Histogram. Switching back to Live Stack will allow stacking to be resumed in these circumstances if another action would cause the stack to reset has not been carried out (for instance changing resolution or colour space).

Status Tab

image

The Status tab shows some more detailed information about the stacking process and the stack so far.  Of interest is the stacking time, which is the amount of time taken to process the alignment and stacking calculations needed for each frame.  If this time is longer than the exposure length, frames will be dropped from the stack (due to the previous frame still being stacked when the next frame arrives).  The right-hand information panel shows warning or error messages if stacking errors are occurring.

Histogram Tab

image

The Histogram tab shows not only the image histogram but allows White Level, Black Level, and Gamma to be adjusted to pull out more faint detail in a stacked image (The Whirlpool Galaxy is a classic example of when to use the sliders).  The Live Stack histogram shows the data for the stack so far (not for the individual frames, even when show individual frames is checked). 

·         Tweaks to the Black Level, White Level and Gamma affect how the image is shown on screen and how it is saved if choosing Save as Viewed

·         The changes do not affect the actual values in the stack or the result if Saving As 16 or 32 bit stacks. 

·         Additionally, the Display Controls on the right, in the Camera Control Panel, affect only how the image is viewed on screen and do not affect any saved data whatsoever.  The Display Controls Gamma/Brightness/Contrast are applied only to the image being drawn on the screen.

 

Adjust White Level

·         The white level applies to the horizontal axis of the histogram, so left is 0% and right is 100%. It is not usually necessary to adjust this control.

 

Adjust Black Level

·         The black level applies to the horizontal axis of the histogram, so left is 0% and right is 100%.

·         Turn up the Black Level slightly (move slider to right) to suppress sky glow/chip noise and give a dark background to an image.  Turning the black level up too far can give the image an unnatural look.

 

Gamma

·         Turn down the Gamma (move slider downwards) to boost faint data.  (In SharpCap version 2.10 there are extra controls for smoothing the transition at the black point and for fine adjustment of the black level).  The range of the gamma is from 0.1 (bottom) to 2.0 (top).

 

Transfer Curve

·         The Red transfer curve shows how the levels between the black and white points are going to be displayed on screen.  The shape of this line is determined by the settings for the black point, white point and gamma controls, and the line acts in a way similar to the ‘Curves’ adjustment found in many image processing applications.  For this line the vertical axis of the graph is the display brightness from black (bottom) to white (top).  The brightness of a pixel in the viewed image is calculated by taking its horizontal position of the pixel on the histogram, moving up to the red transfer curve line and taking the vertical position of the line at that point as the displayed brightness for that pixel.

Reset Adjustments

·         Restores the controls back to their defaults (buggy in v2.9, doesn't reset some controls). 

 

Alignment Tab

image

The Alignment tab controls the alignment process which, along with the FWHM filter, depends on the detection of stars in each image.  SharpCap can only align images in which it can detect stars (do not use Live Stack for planetary or lunar images).

·         A minimum of 3 stars is required for Live Stack with alignment to work.  However, for reliability and good alignment a star count of 10-15 or more is to be preferred.

Alignment Group

·         Align Frames – enable or disable the alignment of frames.  The first frame in any stack becomes the reference frame – all other frames are aligned with that frame when alignment is enabled.  SharpCap uses the stars it detected in the first frame to align all subsequent frames with the stack.  Stars in the stack are re-detected if any of the star detection parameters are changed.  The absolute minimum requirement is 3 stars detected, although having 3 stars is no guarantee of alignment working if too close together or close to being in a straight line for instance.  Ideally, aim for 10-20 or more stars detected with a good distribution across the frame.

·         Allow De-rotation – check box cannot be changed and will be removed in a future version.

·         Align using – to select number of stars.  It can be 10, 15, 20 or 25 stars.  Using a larger number of stars may slow down the stacking process, but may give better alignment results. Only increase this value if detecting plenty of stars but still having difficulty aligning.

Star Detection Group

·         Reduce Noise – when enabled applies a Gaussian blur to help SharpCap to ignore low level noise and hot pixels.  Selecting Reduce Noise is recommended.

·         Black Level Threshold – anything under this level is treated as black and can help to ignore low level noise.  The default is 50, the range 1..254 in steps of 2 by pressing the up/down arrows.  Any value required (in the range) can be typed directly into the box.

·         Digital Gain – can be used to apply a gain during the star detection process if stars are faint and are not being detected.  Values can be Off, 2x, 4x, 8x.  Enabling this may help if SharpCap is not detecting enough stars.

·         Minimum star width – increase this to help stop hot pixels being detected as stars.  The default is 2, range 2..32 in steps of 2 by pressing the up/down arrows.  Any value required (in the range) can be typed directly into the box.

·         Maximum star width – reduce this to limit detection of very bright bloated stars.  The default is 16, range 4..32 in steps of 2 by pressing the up/down arrows.  Any value required (in the range) can be typed directly into the box.

·         Highlight Detected Stars – checking this will put boxes around the detected stars – yellow stars are used for alignment, red are not used for alignment.  This can be very helpful to determine and understand the causes of problems with star detection and alignment.

image

Status Group

·         Shows various data including offset of the frame from the stack, rotation, calculation time and number of stars detected.  Note, if the stacking time (the time taken to calculate alignment and process the stacking of each frame) exceeds the exposure time, frames will be ignored by the live stacking as new frames will arrive while the previous frame is still being processed.

 

Filter Tab

image

The filter allows poor-quality frames (poor atmospheric conditions or clouds) to be excluded from the stack.  Quality is currently judged only by the FWHM (full-width-half-maximum) estimate of the quality of focus in the frame.

·         Filter on FWHM – check to enable FWHM (focus score) filtering.

·         Maximum FWHM – use the slider to specify a maximum FWHM value for frames to be used.  It shows a history of recent frames.  Used frames are green, frames discarded by filtering are red.

·         Filtering does not apply to the first frame in any stack

Darks Tab

A dark can be applied in Live Stacking when using a webcam/frame grabber (DirectShow camera).  For other cameras, darks must be applied via the main camera controls.

image

When darks are being applied, it is possible for the dark frame to have higher pixel values at some points than the light frame (due to random noise in dark areas).  This leads to negative pixel values in the dark subtracted frame, which SharpCap preserves and adds to the stack.  In general, these will cancel out with positive (+ve) pixel values at the same point in other frames, leading to overall better images with less noise than if the negative (-ve) values were discarded.

The requirement to allow for negative (-ve) pixel values means 16-bit pixel values are downscaled to 15 bits (0..65535 range dropped to 0..32767) when live stacking.  As none of the cameras currently supported by SharpCap produce a true 16-bit output (most are 10, 12, 14 bit scaled up to a 16-bit range), there is no loss of quality due to this.

Log Tab

Shows some log information of Live Stacking in more detail than is saved in the main SharpCap log.  If something is not working, this is the place to look.

image

Live Stack Reference

In the background, SharpCap maintains a 32-bit integer value for each pixel of the stack with the value from each frame being added to the pixel value.

·         For a 16-bit camera it is possible to stack up to 32768 (215) frames before running out of values in the stack.

·         For an 8-bit camera it is possible to stack up to 16 million frames (224) before running out of values in the stack.

All files saved during a stack will be saved in a single folder (raw frames and processed stack images saved in subfolders).  This helps keep the saves from the stack together.  The folder is named after normal file naming rules based on the time stacking was started and the name of the target object selected.

image

If the name of the target in the toolbar is changed during Live Stacking, SharpCap will rename the output folder.

Using Live Stacking

A useful video demonstration of using the Live Stack function in SharpCap can be found, courtesy of Charles Copeland, at  https://www.youtube.com/watch?v=zIlJHyVWei4 .

Although the video shows SharpCap 2.7, it is still valid for SharpCap 2.9 and beyond.  This is a good demonstration of what can be achieved with video stacking software using a NexStar 6SE telescope, analogue video camera and 0.5x focal reducer.  Be aware of the comment “if using v2.9 be sure to set Digital Gain to 2X in the Alignment tab” on the web page, below the video.  This may be helpful if it is difficult to detect enough stars, however turning on the Digital Gain when it is not required will reduce alignment accuracy slightly.

The video is worth watching again and again ……

Sample Live Stack Session

The example below documents the preparation and process to image M42, the Orion Nebula.  The equipment used:

·         Celestron C8 SCT.

·         Celestron CG5 Equatorial Mount.

·         Altair Astro GPCAM MONO V1 set to MONO8 colour space.

·         A 0.5x focal reducer and Astronomik CLS filter.

·         Imaging laptop was a Lenovo X61 ThinkPad, with 1.8GHz Core 2 Duo CPU, 4Gb RAM, 120Gb SSD & Windows 10 Pro 32-bit.

Below is the workflow for the image capture session.

1.       Use the focus score tool FWHM Measurement to achieve good focus – see Focusing.

2.       Adjust the camera controls (not the Display Controls), to get a good histogram shape without guessing – see The Histogram.

image

3.       Check against the guidelines for a deep sky histogram (with vertical log scale).

4.       Switch to Live Stack – the histogram shown here has a reasonable shape for a deep sky object.

image

5.       Check to see if the Frames Stacked count is incrementing – if it is, all is well.  If not, it is likely not enough stars are being detected to allow alignment.  In this case go to the Alignmenttab and select Digital Gain 2x and Reduce Noise (these are the adjustments most likely to fix the problem of too few stars detected).

image

6.       From the Tool Bar, create a suitable Target (or Object) name.

image

A new name can be typed here to represent the current object of interest – such as
M42 or Orion Nebula.

image

Subsequent captures would be saved in a sub-folder called M42 (or Orion Nebula) under the default capture folder.  Objects added here will not persist across SharpCap restarts.  To become permanent, the object must be added via File > SharpCap Settings > General tab.

7.       Clear the stack with the Clear button and restart the stack.

image

8.       When several frames have been stacked, do a Save as Viewed using the Save button dropdown list.

image
The resulting PNG file cane be viewed to ensure reasonable data is being captured.

image 

  1. Use Save as 16 Bit Stack to create a FITS file.  This is a copy of the FITS capture file loaded into FITS Liberator – no post-processing.  The histogram has kept ‘reasonable’ shape suggesting worthwhile data is being captured for subsequent processing.

    image

  2. This is the final image from the stack (no post-processing).

    image

This is how the image progressed as the Live Stack was building.

image

image

image

Stack = 1 (1 x 30s exposure)

Stack = 3 (3 x 30s exposure)

Stack = 10 (10 x 30s exposure)

Image building as Live Stack Frames Stacked count increases

 

Changing the black level, white level and gamma affect how the image is shown on screen and how it is saved if choosing Save as Viewed.  These actions do not affect the actual values in the stack or the result if saving as 16 or 32 bit stacks.  Additionally, the Display Controls on the right in the Camera Control Panel can also be used to adjust how the image is displayed on screen. Changes to the Display controls do not affect any saved data whatsoever – the adjustments specified by the display gamma, brightness and contrast controls are applied only to the image being drawn on the screen.

Trouble Shooting Live Stack

The following are common problems:

·         SharpCap will report less than 3 stars are visible (3 stars minimum is required to stack frames) even though there appears to be 3 stars visible in the display.

·         The Frames Ignored count is increasing (see left-hand side of graphic below).

To find out what is happening, enable the checkbox Highlight Detected Stars.  Stars which SharpCap is using (can see) are surrounded by yellow boxes.  In the example below, the problem is poor focus (deliberate, to force the scenario) and frames are being ignored.

image

If none are highlighted, consider the following:

·         Check/Uncheck Reduce Noise.

·         Try different settings for Digital Gain, including Off.

·         Investigate the shape of the histogram.  Check the black level and minimum/maximum star widths are reasonable – faint stars will not be found with a 50% black level for instance.

Stretching the Live Stack Image

Stretching an image is a technique, using image level adjustment, which is useful for bringing out further nebulosity in a deep sky image.

Histogram adjustment can be used to stretch the image during a SharpCap Live Stack capture.  The black point can be set and the gamma adjusted using the appropriate sliders.

 

 image

Adjustments for the graphic above are:

·         Move the Black Level slider to the point where the histogram first rises from zero – moved to the right here.

·         Usually the White Level slider will not need any adjustment.

·         Adjust the Gamma slider to personal preference for how bright the nebulosity areas should be – moved downwards here.

In this example, the red line has been adjusted from straight to curved (stretched) by moving the gamma slider downwards from its default central position.  This action will pull out fainter detail.

·         The Black Level slider is a % scale.

·         The White Level slider is a % scale.

·         Gamma is just a number not a percentage.  Neutral gamma is 1 (middle of the vertical bar), which gives a straight line as the transfer curve (the red line).  Correctly interpreted, gamma of less than 1 will boost the shadows and mid tones, gamma greater than 1 will lower the mid tones and highlights.  [Note: some applications and cameras treat gamma the opposite way around – increasing gamma boosts the shadows.] The image can also be stretched after saving using image processing tools.

·         A useful tutorial for applying a stretch function using FITS Liberator can be found at https://www.aao.gov.au/files/NGC6751_Image_Tutorial_GIMP.pdf .  The document also includes further image manipulation techniques using the open source image processing application GIMP.

·         Nebulosity is another program capable of post processing FITS files.