Processing steps for astrophotographs
Sections in this page
This process is available on the batch menu of GRIP. Since January 2010 there are two versions on that menu:
- takes a set of images assumed to be of stars on a dark background. It detects the stars in each image and analyses the patterns of the 24 brightest ones (the number 24 is modifiable). It determines where each of those stars is in each of the images and then distorts (warps) each image so that the stars are in the same position as in the middle image of the sequence. It adds the warped images together in a 32-bit-per-channel accumulator (32 bits ensures the added brightness levels do not hit a ceiling). The accumulator itself can be saved in a file, in a format that GRIP can reload again (but other applications would not recognise). The accumulator is read out into a normal 16-bit-per-channel image for saving in the widely used TIFF format. The read-out from the accumulator can either be simply by dividing by the number of images, so the warped images are averaged, or the user can use a curves dialogue to get the most contrast in the result. The second method should NOT be used if magnitudes are to be measured in the image but it is very useful for making a good photograph. The main aim in combining photos in this way is to reduce noise and improve contrast, as discussed elsewhere.
This star-image combination process is often referred to in these pages as the "batch astro-process". - is quite similar to the previous option except that instead of accumulating the warped images they are each saved as a TIFF file (the orginal names modified to end with _warp.tif). The idea of this is to be able to analyse and measure stars in sets of photos taken over a long period, not a series taken in quick succession for noise reduction. More facilities will be added to GRIP for doing that analysis (not available yet, Jan 2010).
Selecting either of the above two options from the batch menu results in the following dialogue being displayed. Its title shows which option was selected: the title is either "Astro COMBINE" or "Astro WARP".
Controls in the astro-process dialogue
- is a complicated control with a list of files and 3 buttons. The easiest way to use it is to click its "Browse..." button on the right to select a number of files in the usual way. The files will then be listed and the buttons "View first" and "View last" may then be used to open the first and last images in the list, for visual confirmation that you have selected the right range of images. Having opened either of those images it may be useful to check that certain processes on the levels menu give reasonable results on them, before embarking on the full time-consuming process:
- correct background (if required - not intended for telescopic images)
- auto-threshold (stars)
- detect blobs
- - GRIP was designed on the premise that simply shifting images to superimpose them would not be good enough because camera and telescope optics always distort images to some extent. If objects have moved from one frame to the next they will not be distorted in exactly the same way. So recognising objects by their mutual patterns and then warping to superimpose them for noise reduction was GRIP's original method of working. This is still the method unless you deliberately select one of the following.
- - it has become apparent that there are not always enough stars in a telescopic field for the warping algorithm, which really needs at least 9 objects that are matchable throughout the sequence of images. So this simpler method is offered. It finds the average offsets of all objects from one image to another and simply shifts (ie, translates) an image by that average offset for superimposing it on the accumulating image.
- - in some images (eg, photos of planets) there is really only one large bright object. For this case, GRIP also offers the simplest possibility: measure the offset of only the brightest object in every image and stack the images using only those shifts.
- should be used if you have created a dark frame. There is a browse button for selecting the file. There is also a button for viewing the selected file, for visual confirmation.
- should be filled in if you have created a flat field image. There is a browse button for selecting the file. There is also a button for viewing the selected file, for visual confirmation.
- first does statistics on each image to find the mode in each channel. It then determines which channel has the minimum modal brightness and scales the other channels so that their modes move down to that minimum level. The modal values of astro images usually relate to the background sky. The sky is commonly coloured by light pollution so this operation neutralises the colour by making the background levels all more or less the same. It does not affect the maximum level in each channel so bright objects will not change colour. This option is more suitable for telescopic photos than the next one is. It can be useful even if also using a flat field image. It should not be used if the end result of the processing is to be used for measuring star magnitudes.
- should be ticked if the background level of your images is not uniform (see details here). This is likely to be the case for camera images with lenses of wider angle (say, less than 100mm, for 35mm cameras). If you are processing telescopic images, and particularly with a flat field image, then there is no need to tick this box. It should not be used if the result of the processing is for measuring magnitudes.
- is also only likely to be needed for wide angle photos taken without a motorised drive, to enable them to be mapped onto each other more easily. More details are here.
- may be needed if inverse gnomonic projection is to be done. In many cases it is even then not necessary to enter anything in this field because the focal length can be obtained automatically from metadata in the image files.
- allows certain parameters to be altered from their initial values. The initial values have been found to work reliably on many images so try the processing first with those. The number of brightest stars to measure in each image needs to be at least 9 for the warping algorithm to work. The larger the number, the longer it will take to analyse matches between images. The matching works by considering the vectors between the brightest stars in the image. Two vectors are considered to match if they are of similar length and orientation. The tolerances for measuring similarity can be adjusted here. In practice it has only been necessary to increase them for the second kind of processing, where a number of images taken on quite separate occasions are being matched and their orientations are considerably different.
- . As it says, this is only a diagnostic aid. If you do use it, it is important to close the displayed diagram windows fairly quickly, or you may run out of memory during the processing.
- . If this box is ticked the processing will run right through without any opportunity for intervention. The results will be saved in 2 files: a 16-bit TIFF file and a file twice as big in a special format for the 32-bit-per-channel accumulator. Only GRIP can re-read the accumulator file, to load all of the summed image data back into memory. If the box is not ticked you will get a chance between passes 1 and 2 of the processing to deselect object matches which look wrong.
- button starts the processing of the selected images, as described in further detail below.
- aborts the processing.
- displays the present page in your system's default browser.
Dark frames
The original plan was to identify dark frames automatically among the sequence of images and then, for each real image, to subtract the dark frame which was taken at the nearest time. The identification of dark frames proved to be unreliable so a simpler approach has been adopted. It is now assumed that you have used the averaging batch process on a series of dark frames beforehand. The dialogue explained above asks whether there is such an averaged dark frame and where it is.
There is more about dark frames here.
Flat fields
Since version 8.1.21 of GRIP it has been possible to use flat field images, if available, for the telescopic process. A flat field is a photo of a uniformly illuminated white area, completely filling the frame. This must be photographed with exactly the same optical arrangement as the images for which this is to be used to correct.
There is more about flat fields here.
The steps of the process
Here is a combined description of both the lens and telescope processes as they stand now:
- User selects an arbitrary number of image files to process. They must be all in the same format but that may be RAW if the particular RAW format from the camera can be read by the jrawio library (find that out by trying to open a RAW image file in GRIP before starting this process; if it fails it will be necessary to convert the images to TIFF through other software before starting this process)
- The user selects an averaged dark frame image (if there is one); it is loaded; if it is RAW it is interpolated, scaled and its dark margin trimmed (as set in the configuration menu)
- If in the telescope process: the user selects a flat field image (if there is one); it is loaded; if it is RAW it is interpolated, scaled and its dark margin trimmed (as set in the configuration menu)
- Pass 1: for each image file
- load the image from file
- if the image was in RAW format, do the necessary interpolation and scaling and trim its dark margin (as set in the configuration menu)
- if there is a dark frame, subtract it
- if there is a flat field image, divide by the flat field image.
- if selected by the user, correct background
- if gnomonic projection selected by the user, find lens focal length mm from metadata and do inverse gnomonic projection
- if the image has been modified by any of the preceding steps, save the adjusted image as a temporary file in TIFF format
- determine a threshold for each channel (red, green, blue):
- find mode (assumed to be mean of background)
- find standard deviation
- threshold is 4 standard deviations above mode (4 is a configurable parameter)
- apply the threshold to all pixels threshold and detect contiguous blobs
- list the positions of the centres of the brightest N objects (N is a configured parameter; see the configuration menu)
- Analyse the positions measured in all the images to match brightest blobs between images
- Pause to let the user reject some matched objects (not usually necessary, but in case some non-star objects have been matched). This is done by displaying a diagram of all the matches and asking the user to draw rectangles intersecting the match trails which are to be rejected. Here is a portion of an example of such a diagram (the diagram is displayed as an image in GRIP's usual way, so it can be manipulated and saved also).

This diagram shows part of the constellation of Andromeda. Numbering starts at 0 and roughly increases as measured star brightness decreases (though it is really more complex than that). Confirmation is sought before each trail is deleted. - Pass 2: for each image
- load the image from file (from the temporary file if one was made in pass 1)
- use the measurements from pass 1 to warp the image slightly, like a rubber sheet, so its brightest objects fit over the brightest objects in the middle image in the sequence
- add the warped image into an accumulator image (32 bits per channel)
- delete the temporary file, if there is one
- Present a curves dialogue to allow the user to adjust contrast as the result is read out from the 32-bits-per-pixel accumulator back into a normal 16-bits-per-channel image.
- Save the result as a file called processed.tif in GRIP's own directory, as a safeguard in case the user forgets to save it.
- Display the result in the usual GRIP image frame with all menus available.
As of version 9.11.25 of GRIP another window opens at the end of the batch astro-process to summarise the displacements between all the images that have been processed. An example can be seen here.

