Introduction to GRIP

 

GRIP was originally designed to stack together astronomical photos taken with a digital camera on a fixed tripod from a light-polluted urban site so that as much faint detail as possible could be seen.

Here is an example:

Comet 103P/Hartley was moving towards the Perseus double cluster, h & χ Per. This photo was taken without a telescope, from a light-polluted suburban site. The camera was simply fixed on an undriven photographic tripod. 64 exposures of 10 seconds each (to avoid star trails) were combined by GRIP to make this result. You don't need an equatorial mount and fancy guiding equipment to do this! Just some software - GRIP.

Canon EOS5DMkII 24-105mm lens @ 105mm f/4.0 64x10s ISO6400 2010-10-06 19:34:16-19:46:48 UT
From Whitley Bay 55.1N 1.5W 10m asl. Suburban, significant light pollution (6.5 Bortles)

Since it started in 2001, GRIP has grown to be a comprehensive image processing and measurement tool that can also be used for working with professional images, such as from space projects, to be found on the Internet.

 GRIP running

This is what GRIP can look like when running (on 64-bit Windows 7 in this case, but any system on which Java Standard Edition runs will do - that means most computers).

Notice that each image has its own menu bar. Also the main GRIP window, top left, has menus for opening or creating images and for processing batches of images automatically. The top right window at the back is a table of currently opened images and it too has a menu, most importantly for combining any images selected as rows in the table (2 of the 3 images are selected in this example). Three different kinds of image are shown here: a JPEG image having 8 bits per colour channel (or band), a 16-bits-per-channel TIFF image and a 32-bits-per-channel FITS (astronomy format) image. GRIP can handle up to 64 bits (floating point) for any number of channels in an image. The black window at the back, bottom left, is a console window showing information being sent to a log file as GRIP runs. It can show you what is currently happening but you can run GRIP without that window if you wish (the information is still logged in a file).

 Image file formats

GRIP can read several different standard image file formats and also save its results for reloading later or for transfer to other applications. The following diagram summarises its use of image file formats and enables various features of GRIP to be introduced.

         

The red numbers refer to notes below the diagram.

The terms "channel" and "band" are used interchangeably in GRIP. A monochrome image has one channel. A red/green/blue (RGB) image has 3 channels. Images from spacecraft may have any number of channels, in which case GRIP can process them but can only display 3 of the channels simultaneously as one image. If there are more than 3 channels (in a FITS file, for example) each channel will first be displayed in its own monochrome frame. The combination menu can then be used to select any 3 channels for a combined display and so for processing together.

  1. FITS = Flexible Image Transport System is the standard image file format used in astronomy, approved by the International Astronomical Union (IAU) (link to further details and formal specification). It can store image data, for each pixel in each channel, to various accuracies: 8-, 16- or 32-bit integers or 32- or 64-bit floating point numbers. The larger the number of bits, the more memory is required, either as a disc file or in RAM for displaying and processing the image. FITS is the usual format for storing images from CCD cameras.
  2. RAW files are produced by digital cameras made for the non-scientific market. That usually means DSLR (digital single-lens reflex) cameras but some fixed lens "compact" cameras can also save their RAW data. RAW is not an abbreviation but it is usually written in capitals to make the meaning clear. Until recently RAW files held pixel data to 12 bit accuracy but increasingly 14 bits is the norm. RAW is a different format for each camera manufacturer and even between models from one manufacturer, so it is the least standard of the formats GRIP can read.
  3. GRIP can read some RAW formats but not all, using a software product called jrawio, which is unfortunately not keeping up with the latest camera models. For some cameras it may therefore be necessary first to convert RAW to another format, of which the most suitable is TIFF (see note 4). That can be done using various other applications, such as Adobe PhotoShop or, for Canon cameras, Digital Photo Professional (DPP) supplied free with the cameras.
  4. TIFF is the Tagged Image File Format. It originated in the graphic arts arena but is very widely used, partly because it stores a lot of metadata (data about the image) as well as the image itself. It is also useful here because it can store 16 bits per channel. TIFF is useful for presenting complete images to professional printers.
  5. JPEG (named after a Joint Photographic Experts Group) is the format known best to amateur photographers. It is convenient because its files can be very small. However small size comes at a price. A lossy method of compression is used. While that may be fine for "snaps" it loses the fine detail that is often important in astrophotos. It can introduce artefacts into the image in the form of ripples or unexpected spots. It is also limited to 8 bit precision so JPEG throws much of the original data away. I have discussed this further on my camera techniques page.
  6. PNG (Portable Network Graphics) was designed specifically for the Internet. It comes in two flavours: PNG-8 for graphics and PNG-24 for RGB photographs. It compresses without loss so the files are larger than JPEG but do not lose anything. This can be a useful format for putting results on the web or for sending them by email.
  7. Images with larger bit-depth have the capacity for adding up a lot of normal images without the pixel values reaching the maximum allowed value. That is important for getting faint detail out of images, as explained on my exposure settings page.
  8. When the diagram was drawn (early 2011) the 64-bits-per-channel accumulator was only used as a temporary holding area for images loaded from floating point (32- or 64-bit) FITS files. That is no longer the case. GRIP's 64-bits-per-channel images now have all the functionality of less deep images.
  9. The 32-bits-per-channel images are also fully functional as an image. All of the image processing and measurement capabilities of GRIP can now (as of version 11.5.1) be performed in such images without first scaling them down to shallower bit depth. A version of the image is displayed in a window with its own menu bar. The display is either monochrome or RGB colour, depending on whether there are 1 or more channels. Here is an example of an image window with its menu bar:
  10. One way to obtain an image having 32 bits per channel is to combine a sequence of 16-bit images, "stacking" them (see the Batch/Astro menu). GRIP detects star patterns in each image and then warps the images (like rubber sheets) to add them one on top of another. To prevent the brightness levels reaching a ceiling, such an accumulator image, deeper than 16 bits, is necessary. In earlier versions of GRIP the accumulator then had to be scaled into another 16-bit image for further processing but that is no longer necessary. All processing and measurement can now be done in the full 32-bit image. It can also be saved as a FITS file at any stage.
  11. In earlier versions of GRIP (before 11.5.1) saving FITS files was not possible so GRIP had its own very simple file format for saving accumulators and loading them back later. The drawback was that only GRIP could read those .accum files. They are now obsolete but GRIP will continue to be able to read them.
  12. One of the options on the levels menu of a 32-bit image is conversion to a 16-bits-per-channel image. It is done simply by scaling the range of the data currently held in the image linearly into the range from 0 to 65,535.
  13. Again, in versions before 11.5.1 GRIP could only do image processing and measurement in images having at most 16 bits per channel, so deeper images had first to be converted to this type. That restriction no longer applies. (16 bits per channel is the most a standard Java BufferedImage can hold. GRIP uses its own structure for the deeper images.)
  14. The levels menu of each image also has options for converting between 16 and 8 bits per channel by simple linear scaling.
  15. An image having 8 bits per channel is useful for saving as a JPEG file after all processing has been done, so the result can be displayed on the web as a small file. Usually at least a 16-bit TIFF file would be saved too because JPEG loses details.

 Some general points

 Undoing steps

GRIP does not have an "undo" menu option. This is quite deliberate because we are dealing with large images. An accumulator created by stacking images from my DSLR occupies 250 megabytes. It was deemed an unnecessary overhead to keep making copies of that amount of data just in case a step needed to be reversed. Users should instead save intermediate results as files or use the "Clone" and "Reload from file" options on the image menu.

 Java

GRIP is written in Java. That means it is not the fastest image processor but it is still impressive. Java has 2 particular advantages. Firstly it means GRIP will run unmodified on most platforms: on the various flavours of Unix (Linux, Solaris, etc), on Windows, on MacOS, etc. Secondly it is easy for Java programmers to extend it for particular requirements: the API (application programming interface) is documented here and sophisticated programming tools are available completely free from various sources.

 Blobs

Blobs are contiguous groups of pixels that have been detected as being of interest for some reason. A blob might be a star, for example. We don't use the term "object" because that would be confusing to Java programmers (a blob is represented by 2 objects: one describing the boundary and another describing the interior region). In some image processing systems our blobs would be called ROI's (regions of interest).

The general term for the process of detecting blobs is "segmentation": segmenting interesting pixels from the background. A crude method of segmentation is thresholding: detect all pixels that lie within a user-selectable range of brightness levels. GRIP does offer that as an option in the levels menu. Detecting stars is obviously very important for GRIP and so a special algorithm has been developed. It can detect stars even in the presence of background variations such as occur when there is also some nebulosity around. Thresholding would not be adequate in such cases.

Once blobs have been detected, and held as a list of boundary and region descriptions, they can be measured. Not only geometrical measurements such as width or area can be made, but also by referrring back to the pixel data we can measure total brightness in each channel. From there we can go on to compare with reference stars (other blobs in the image) to measure astronomical magnitude and astrometric position. GRIP offers all of these things.

 Grey levels

Another term in image processing that can cause confusion is "grey level". It simply means the brightness in a given channel (or band) of the image. In a coloured image (typically having red, green and blue channels) grey level is still a meaningful term within each channel.

 Processing facilities

The following can be applied to 64- and 32-bit accumulators as well as to 16- or 8-bit images, all monochrome or RGB unless otherwise stated. Most of the image processing options can also be applied to a set of files without them being displayed, from the batch menu on GRIP's small main window.

 Image menu

More details of the image menu

 Measurement menu

More details of the measurement menu

 Geometry menu

More details of the geometry menu

 Levels menu

The levels menu also contains options for segmenting the image, detecting blobs and measuring them. So the following are also provided.

More details of the levels menu

 Blob menu

This menu only appears when a detected blob has been clicked upon with the mouse and is then displayed greatly magnified in its own image window.

More details of the blob menu

 (De-)Convolution menu

Linear and nonlinear convolutions (filters) are available here as well as deconvolution (recovering blurred detail).

The common factor is that a square pattern is applied in the neighbourhood of every pixel in the image. This tends to be time-consuming so progress bars are shown.

Some standard nonlinear filters come first in the menu, for all of which the size of the square pattern can be selected:

More general convolutions and deconvolutions are done by setting up a kernel (the square pattern). That can be done in several ways, including sampling the image to get the shape that stars, that ideally should be points, have become as a result of the optical system. Knowing that stars should be points (certainly in any amateur telescope) makes deconvolution more feasible.

More details of the convolution menu

 Combining images

In addition to all of the above there is another rich set of operations for combining 2 or more images. This is available from another window that is displayed when GRIP starts: the image table. The table summarises all image windows that are open at any time. It has a menu bar enabling any images in the table to be selected. Depending on the number of images selected, various options become available in the "Combine" menu:

More details of the image combination menu

 Batch processing etc

The small window containing the GRIP logo has its own menu bar containing three useful menus.

 File menu

The File menu enables image and other files to be opened. It also enables star charts to be created. Star charts are useful in GRIP because stars can be identified in images and star data from Hipparcos and Tycho catalogues can then be attached to the identified stars in a simple process that involves clicking on the chart and then on your image. This is particularly important for measuring the magnitudes of stars in relation to known reference stars, a process known as photometry.

More details of the main file menu

 Batch menu

Many of GRIP's image processing operations may be applied to a set of files automatically, in sequence. This is done without displaying each individual image, so it is faster. New versions of the images are saved with modified file names (they never overwrite the original files).

Importantly also the batch menu has the options for stacking astrophotographs.

More details of the batch menu

 Configuration menu

There are a few things that can be set once here and GRIP will remember them whenever it runs.

More details of the configuration menu

 Downloading GRIP

The program may be downloaded from the next page.

Next page