Hi all,
A new version of the standard ImageRegistration module is now available to all our users. The new version includes a largely improved StarAlignment tool. I describe the new features and performance improvements later on this post.
Download FilesDownload the appropriate module(s) for your platform(s) by right-clicking on the links below and selecting "save file as" or "save link as":
*
Linux/X11 32-bit*
Linux/X11 64-bit*
Mac OS X 32-bit*
Windows 32-bit*
Windows 64-bitInstallation InstructionsAll Platforms- If you have PixInsight running, exit all running instances.
- Uncompress the module installation archive (Windows and Mac: a .zip file; Linux: a .tar.gz file).
- Now you have the module file:
ImageRegistration-pxm.<suffix>, where
<suffix> is:
.so for Linux;
.dylib for Mac OS X;
.dll for Windows.
Linux/X11- Copy the
ImageRegistration-pxm.so file to your bin installation directory, replacing the old file. Assuming you've installed PixInsight under your home directory, the bin directory should be something like $HOME/PixInsight/bin
Mac OS X- Open your Applications folder with Finder (or the folder where you have the PixInsight application).
- Right-click the PixInsight.app application bundle.
- Select "Show Package Contents" from the context menu.
- A new Finder window opens. Select the Contents/MacOS folder.
- Copy the new
ImageRegistration-pxm.dylib file to the Contents/MacOS folder, replacing the old one.
Alternatively, if you don't mind using the terminal, the following single command does the trick:
cp ImageRegistration-pxm.dylib /Applications/PixInsight.app/Contents/MacOS
Windows- Copy the
ImageRegistration-pxm.dll file to your bin installation folder. Assuming you've installed PixInsight on the default location, the bin folder is: C:\PCL\bin for 32-bit versions; C:\PCL64\bin for 64-bit versions.
Improved StarAlignment ToolThe StarAlignment tool has undergone important improvements in this version. Now it is a much more powerful and flexible automatic image registration tool. Most of the improvements target the difficult problem of generating accurate mosaics with minimal overlapping between mosaic frames, although they apply equally to all image registration tasks.
Below is a brief description of the main new and improved features. Detailed descriptions will be included in upcoming new videos that will complete the
mosaic construction series.
New Preview-Based Mosaic Construction ModeWhen any of the views involved in an image registration task --either the reference image or a target image-- has one or more previews defined, StarAlignment restricts the star matching process to the areas covered by the previews. By defining previews roughly covering the overlapped areas, StarAlignment is able to build mosaics of any practical size and complexity.
For example, in this screenshot we have defined two previews on both the reference mosaic image "TR_mosaic", and the new mosaic frame "BR" (images courtesy of Nikolay Volkov) :
And here is the final mosaic and the mask corresponding to the newly added frame:
Following the same scheme, huge mosaics can be constructed (RAM permitting) with minimal user intervention (just defining a few previews in each step).
Simple mosaics consisting of two frames with sufficient overlapping can normally be generated with StarAlignment applied directly to the images, with no previews defined. However, when the overlapped areas are small (compared to the total area of the image), StarAlignment can be unable to find a valid registration model. The reasons for this limitation are related to the algorithms implemented in the star pair matching stage of the StarAlignment process (in particular, the RANSAC routine is sensitive to a large amount of outliers, or false putative star pair matches). The preview-based registration system, besides overcoming this limitation, also improves the accuracy of the registration model by increasing the probability of finding more star pair matches within the overlapped image regions.
Improved Bicubic Spline InterpolationStarAlignment uses a bicubic spline interpolation algorithm to generate pixels of registered target images. The bicubic spline algorithm is extremely accurate, but in presence of wild brightness variations between neighbor pixels, it can generate out-of-range values that yield dark artifacts around bright image features. These variations are quite frequent in linear CCD images, and the generated artifacts are a consequence of the oscillatory behavior inherent to cubic polynomials.
The PixInsight/PCL implementation of bicubic spline interpolation has always had a special
linear clamping mechanism that automatically switches to linear interpolation when too large variations are detected between adjacent pixels, preventing oscillatory artifacts. The default clamping parameters are valid for the vast majority of linear images, but in particularly difficult cases (extremely large variations), a more restrictive clamping may be necessary. The new version of the StarAlignment tool includes a
clamping threshold parameter to this purpose.
An example with a very difficult image can be seen below (image courtesy of Jordi Gallego). This is a rare case where the default clamping threshold (0.3) cannot fix some of the dark interpolation artifacts.
Bicubic spline interpolation, clamping threshold = 0.3 (default value)
Bicubic spline interpolation, clamping threshold = 0.1 (custom value)
The advantage of our clamped interpolation scheme is that the properties of bicubic spline interpolation (accurate representation of original image features after geometrical transformations) are preserved while an artifact-free linear interpolation is applied on a per-pixel basis when necessary, that is where high variations can cause oscillation problems.
New 2D Surface Spline Interpolation for Coordinate TransformationsTo generate a registered image, two interpolations are required:
- A
pixel interpolation, to generate registered pixels from a set of adjacent pixels in the source image. This is the bicubic spline interpolation algorithm, as we have described in the preceding section.
- A
coordinate interpolation, to map pixel locations in the final registered image to pixel locations in the source image, by inverse projection.
Two coordinate interpolations are now available in StarAlignment:
- Projective transformation (an 8-parameter homography). This is the default method, which was also the only one available in previous versions of the tool. For normal image registration tasks, this provides the fastest and most accurate registration model.
- 2D surface splines (a.k.a.
thin plates) of second order. This method is the best choice for mosaics. Surface splines are the adaptable and accurate interpolation devices necessary to model small-scale distortions. An example can be seen below (image courtesy of Jordi Gallego):
Projective transformation
2D surface splines
These images are small crops of the seam between two mosaic frames. Note the stars that get clipped at the edges of the mosaic frames. the joints between stars are perfect in the mosaic constructed with surface splines, but the projective transformation has not produced a satisfactory result. Note however that this is an extremely difficult case; projective transformations usually perform much better than this.
New Star Matching Parameters- RANSAC Tolerance. This parameter allows for registration of images subject to differing small-scale distortions, as happens frequently in mosaic construction. The default value is 2 pixels, but the parameter can be varied in the range from 0 to 4 pixels. A zero tolerance means that absolutely no distortion can be allowed. In general, StarAlignment won't work with a zero tolerance on real-world images. Higher tolerance values allow more distortion, but be aware that too large of a tolerance value can lead to an unstable star matching process. Unstable means in this context that StarAlignment can find a completely wrong registration model, due to excessive uncertainties in the star matching process.
- RANSAC optimization parameters. In previous versions of StarAlignment, the RANSAC algorithm always searched for a registration model including as many star pairs as possible. The new version is much more sophisticated. Four optimizations are now implemented:
* Maximize inliers. This optimization tries to include as many star pairs as possible in the registration model (the only optimization available in previous versions).
* Maximize overlapping. This optimization tries to find a registration model that covers the largest possible portion of the overlapping region between the images.
* Maximize regularity. This optimization tries to find a registration model where the star pairs are as regularly distributed as possible throughout the overlapping region between the images.
* Minimize RMS error. This optimization tries to find a registration model with the smallest possible root mean square error in the predicted positions of all reference stars.
There is an independent parameter that controls the weight of each of these optimization criteria. The default values are all equal to one, which means that RANSAC pursues equally the four optimizations by default. Although you normally won't need to change these parameters (they are advanced parameters reserved for extremely difficult cases), now you know why and how this new version of StarAlignment works much better to find the most accurate way to register your images.
New Register/Union Separate Working ModeIn the "separate" mosaic mode, StarAlignment generates two images for each mosaic: one for the reference image and another for the registered target image, instead of a single mosaic image with both images. Separate mosaic images can later be joined with the Max() function of PixelMath. With separate mosaic images you have more possibilities to control the mosaic generation process. For example, you can blur the edges of each mosaic frame to achieve smooth transitions.
New Default Parameter ValuesSome parameters have now different default values, based on exhaustive testing:
- The default number of triangles per star has been increased to 40 (previously 32). In addition, irrespective of this parameter StarAlignment will now generate all existing triangles between the 100 brightest stars of each image (161,700 triangles).
- The default peak response has been increased to 0.8 (previously 0.7).
- The default maximum number of RANSAC iterations has been increased to 2000 (previously 1000).
- The default scale tolerance has been decreased to 0.01 (previously 0.10)
=============
I hope you'll like it. There's a lot of hard research and development work put into this tool. As always, opinions and bug reports (and success stories, too) are welcome.