giant.stellar_opnav.star_identification

This module provides the star identification routines for GIANT through the StarID class.

Algorithm Description

Star Identification refers to the process of matching observed stars in an image with a corresponding set of known star locations from a star catalogue. Making this identification is the first step in performing a number of OpNav tasks, including attitude estimation, geometric camera calibration, and camera alignment, as well as a number of photometry tasks like linearity checks and point spread function modelling.

In GIANT, star identification is handled using a random sampling and consensus (RANSAC) approach using the following steps:

  1. The a priori attitude information for each image is used to query the star catalogue for the expected stars in the field of view of each image.

  2. The retrieved catalogue stars are transformed into the camera frame and projected onto the image using the a priori image attitude and camera model.

  3. The projected catalogue locations are paired with points in the image that were identified in the image by the image processing algorithm as potential stars using a nearest neighbor approach.

  4. The initial pairs are thresholded based on the distance between the points, as well as for stars that are matched with 2 image points and image points that are close to 2 stars.

  5. The remaining pairs are randomly sampled for 4 star pairs

  6. The sample is used to estimate a new attitude for the image using the DavenportQMethod routines.

  7. The new solved for attitude is used to re-rotate and project the catalogue stars onto the image.

  8. The new projections are compared with their matched image points and the number of inlier pairs (pairs whose distance is less than some ransac threshold) are counted.

  9. The number of inliers is compared to the maximum number of inliers found by any sample to this point (set to 0 if this is the first sample) and:

    • if there are more inliers

      • the maximum number of inliers is set to the number of inliers generated for this sample

      • the inliers for this sample are stored as correctly identified stars

      • the sum of the squares of the distances between the inlier pairs for this sample is stored

    • if there are an equivalent number of inliers to the previous maximum number of inliers then the sum of the squares of the distance between the pairs of inliers is compared to the sum of the squares of the previous inliers and if the new sum of squares is less than the old sum of squares

      • the maximum number of inliers is set to the number of inliers generated for this sample

      • the inliers are stored as correctly identified stars

      • the sum of the squares of the distances between the inlier pairs is stored

  10. Steps 5-9 are repeated for a number of iterations, and the final set of stars stored as correctly identified stars become the identified stars for the image.

It is also possible to skip the RANSAC algorithm, stopping at step 4 above and marking any pairs that remain after the check as correctly identified stars.

Note

For the above algorithm an a priori attitude is needed for each image in which stars are being identified. While most OpNav images will have an a priori attitude, in some cases they may not due to anomalies on the spacecraft. This is known as the lost-in-space problem. Currently GIANT does not have the ability to handle the lost-in-space problem and the user will first need to use other software to determine an a priori attitude for the images (such as astrometry.net). We are currently developing the algorithms required to perform lost in space star identification using hash code based pattern matching (similar to the techniques used by astrometry.net) in GIANT, but they are unfortunately not complete yet.

Unfortunately, the star identification routines do require some human input to be successful. This involves tuning various parameters to get a good initial match. Luckily, once these parameters are tuned for a few images for a certain camera set under certain conditions, they largely should apply well to all similar images from that camera. Below we discuss the different tuning parameters that are available in the StarID class, and also some techniques for getting successful identifications.

Tuning the StarID routines

There are a few different parameters that can be tuned in the StarID class when attempting to get a successful star identification for a set of images. Each of these parameters and what they control are described in the following table.

Parameter

Description

max_magnitude

The maximum magnitude to query the star catalogue to. This is useful for limiting the number of catalogue stars that are being matched against. Remember that stellar magnitude is on an inverse logarithmic scale, therefore the higher you set this number the dimmer stars that will be returned.

min_magnitude

The minimum magnitude to query the star catalogue to. This is useful for limiting the number of catalogue stars that are being matched against. Remember that stellar magnitude is on an inverse logarithmic scale, therefore the lower you set this number the brighter stars that will be returned. Typically this should be left alone.

max_combos

The maximum number of samples to try in the RANSAC algorithm. The RANSAC algorithm will try at most max_combos combinations when attempting to identify stars. The only way it will try less than max_combos is if there are less unique sample combinations possible, in which case the RANSAC algorithm will try every possible sample (and becomes just a simple Sampling and Consensus algorithm). This parameter is also used to turn off the RANSAC algorithm by setting it to 0. This stops the star identification process at step 4 from above.

tolerance

The maximum initial distance that a catalogue-image poi pair can have for it to be considered a potential match in units of pixels. This is the tolerance that is applied before the RANSAC to filter out nearest neighbor pairs that are too far apart to be potential matches.

ransac_tolerance

The maximum post-fit distance that a catalogue-image poi pair can have for it to be considered an inlier in the RANSAC algorithm in units of pixels. This is the tolerance used inside of the RANSAC algorithm to determine the number of inliers for a given attitude solution from a sample. This should always be less than the tolerance parameter.

second_closest_check

A flag specifying whether to check if the second closest catalogue star to an image poi is also within the tolerance distance. This is useful for throwing out potential pairs that may be ambiguous. In general you should set this flag to False when your initial attitude/camera model error is larger, and True after removing those large errors.

unique_check

A flag specifying whether to allow a single catalogue star to be potentially paired with multiple image points of interest. In general you should set this flag to False when your initial attitude/camera model error is larger, and True after removing those large errors.

By tuning these parameters, you should be able to identify stars in nearly any image with an a priori attitude that is remotely close. There are a few suggestions that may help you to find the proper tuning faster:

  • Getting the initial identification is generally the most difficult; therefore, you should generally have 2 tunings for an image set.

  • The first tuning should be fairly conservative in order to get a good refined attitude estimate for the image. (Remember that we really only need 4 or 5 correctly identified stars to get a good attitude estimate.)

    • a large initial tolerance–greater than 10 pixels. Note that this initial tolerance should include the errors in the star projections due to both the a priori attitude uncertainty and the camera model

    • a smaller but still relatively large ransac_tolerance–on the order of about 1-5 pixels. This tolerance should mostly reflect a very conservative estimate on the errors caused by the camera model as the attitude errors should largely be removed

    • a small max_magnitude–only allowing bright stars. Bright stars generally have more accurate catalogue positions and are more likely to be picked up by the ImageProcessing algorithms

    • the max_combos set fairly large–on the order of 500-1000

  • After getting the initial pairing and updating the attitude for the images (note that this is done external to the StarID class), you can then attempt a larger identification with dimmer stars

  • If you are having problems getting the identification to work it can be useful to visually examine the results for a couple of images using the show_id_results() function.

Warning

This script loads the lost in space catalogue from python pickle files. Pickle files can be used to execute arbitrary code, so you should never open one from an untrusted source. While this code should only be reading pickle files generated by GIANT itself that are safe, you should verify that the LIS_FILE and the file it points to have not been tampered with to be absolutely sure.

Classes

StarID

The StarID class operates on the result of image processing algorithms to attempt to match image points of interest with catalogue star records.