PixInsight 1.8.0 Ripley: StarAlignment: Improved Distortion Correction

Juan Conejero

PixInsight Staff
Staff member
In a previous post from July, I described the new features we had implemented in the StarAlignment tool. One of the most relevant of these features is StarAlignment's new local distortion correction capabilities. Now I'll describe an important improvement that is now available in the latest version of this tool, which makes distortion correction even more accurate and robust, especially in difficult cases.

As you know if you've read my previous post, StarAlignmen't distortion correction algorithm uses two-dimensional surface splines, also known as thin plates, as a non-rigid mathematical model to describe the geometrical transformation necessary to register two images. Surface splines are extremely adaptable to local function variations, which makes them particularly appealing as flexible interpolating devices in many image analysis and processing tasks. We already have been using them for a long time in tools such as DynamicBackgroundExtraction and DynamicAlignment.

So far, StarAlignment's distortion correction has been using interpolating surface splines. In an interpolating spline, each data point is reproduced exactly by evaluation of the spline functions. In the case of image registration, this means that for each matched star pair, the target image star is registered exactly on its reference image counterpart. This sounds good at first sight, since after all, "perfect" star matches guarantee a "perfect" image registration. But as you surely know if you've been involved in this image processing business for some time, the words "perfect" and "exactly" almost invariably denote a questionable procedure or implementation.

As implemented in our StarAlignment tool, distortion correction by interpolating surface splines works very well most times. However, it can work not so well sometimes, and I'm going to put a "nice" example of this problem here. Before you continue reading and getting scared by some image comparisons, the good news is that (1) these problems are now fixed with the new implementation, and (2) these problems only happen in particularly unfavorable cases.

The following screenshot shows PixInsight 1.8.0 Ripley while working on a two-frame mosaic by Vicent Peris, who has released the final image on the Gallery forum board. The mosaic covers a nice region of the Large Magellanic Cloud, close to the Tarantula nebula.


Although not evident at first sight, this data set has two properties that expose the weakness of interpolating splines used as image registration models:

1 - It is a wide-field image crowded of stars.
2 - Seeing was not particularly good, so the stars have quite flat profiles.

The first property increases the probability of overlapped, colliding, or very close star images. Although StarAlignment's star detection routine does a good job trying to avoid such problematic star images as registration references, decreasing the average distance between nearby star images doesn't help to compute accurate star positions. The second property makes things even worse for star detection, since a flat star profile increases the uncertainty in the computed star position. As a result, the registration model is less accurate, more uncertain, and contains a non-negligible amount of mistakes. If we use interpolating surface splines to reproduce all star pair matches exactly, the result is a very good example of the difference between numerical accuracy and model adequacy:

Image animation: Registration with distortion correction, interpolating surface splines.

To generate the above animation, we have registered both mosaic frames with StarAlignment working in Register/Union - Separate mode and the new Spline smoothness parameter set to zero. This effectively forces StarAlignment to use pure interpolating splines, which has been the only option available until now. To combine both mosaic frames in a way that maximizes registration differences visually, we have applied the maximum operator with the following PixelMath expression:

Code:
max( $T, the_other_mosaic_frame )

on a full preview on one of the mosaic frames. What you are looking at on the above animation is the result of excessive local adaptation, or excessive flexibility in the registration model.

Enter approximating surface splines. In contrast to interpolating splines, approximating splines don't reproduce all data points exactly. Instead, approximating splines introduce some degree of smoothness in the computed registration model. This is a more realistic approach because it assumes that there are errors in the computed star positions, or in other words, that the star positions are really not known exactly, but are just approximations.

To understand how approximation works as opposed to interpolation, consider the following 256x256 pixels grayscale image.

spline-test.png

For a moment, forget that this is an image of stars; just take it as a set of scattered measurements of some process represented as varying intensities on a square matrix.

With a simple script in PixInsight, I have generated an interpolating 2-D surface spline from 1024 pixels of the above image, distributed on a regular lattice at intervals of 8 pixels (or a grid of 32x32 interpolation points). When we use this spline to interpolate the original image, we get the following result:

spline.svg

Since the interpolating spline reproduces all data points exactly, we get a wildly varying representation because the original data also vary strongly at small scales. This is an accurate representation of the original data set, but it is not necessarily an accurate representation of the underlying true function.

With approximating surface splines we can get a much better view of the data from a less local, more global perspective. A nice feature of approximating surface splines is that we can control the degree of regularization, or smoothness, with a single numerical parameter:

spline-smoothing-0.05.svg
spline-smoothing-0.15.svg
spline-smoothing-0.35.svg

Now that you know how it works, let's repeat the same mosaic with the new Spline smoothness parameter of StarAlignment set to its default 0.25 value:

Image animation: Registration with distortion correction, approximating surface splines.

Here are animations of the same area zoomed 8:1:

Image animation: Registration with distortion correction, interpolating surface splines (zoom 8:1).

Image animation: Registration with distortion correction, approximating surface splines (zoom 8:1).

For a better comparison, this is the same region of the mosaic generated using a projective registration model without distortion correction:

Image animation: Registration without distortion correction, projective model.

The best part of this new feature is that it works very well with its default parameter value in virtually all cases, so you won't have to worry about a new parameter: StarAlignment remains a tool that "just works", and that's even more true with approximating surface splines.
 
Juan,

Given how good this tool is now, are there any cases where there is an adequate star field where you would recommend using Dynamic Alignment instead of the Star Alignment tool.  I am struggling to come up with any.

Thanks,

Jim
 
Hi Jim,

At present there are very few practical cases where DynamicAlignment is really necessary, at least in its current state. However, I plan on revamping this tool to make it more accurate and better adapted to mosaic construction (right now one has to make room 'manually' with the Crop tool to create mosaics with DA). When this happens, there will be cases where DA will be easier to use than SA, especially for mosaics of very dissimilar images, such as pasting the core of M42 on a giant mosaic of the whole Orion constellation, and other wild things that are becoming so popular these days.
 
As we spoke some days ago, the key to align is to not align. The problem with splines is that they are too much effective correcting distortions, in the sense that they completely fit the position of a *single* star between two different frames. This generates local distortions because every image has its noise and, in poor seeing conditions, the star centroid calculations may have poor precision values. With the smoothing factor, the distortion model is not passing exactly trhough any of the matched stars, but distortion is still well corrected because the correction is done at the global image scale.


Regards,
Vicent.
 
Have you ever tried to implement a distortion model that just corrects the usual pin cushion and barrel distortion? These models are relatively stiff and therefore smooth. But I dont know if it is maybe not sufficient to match all kinds of distortion you find in real situations in AP.

Georg
 
Yes. But as you say, theoretical distortion models are mostly useless for real world images. They can be used as a first approximation, but the current predictor-corrector algorithm is a general and much more accurate solution IMO.
 
Back
Top