Author Topic: Updated module: ImageRegistration (2009/12/15)  (Read 8450 times)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Updated module: ImageRegistration (2009/12/15)
« on: 2009 December 15 17:35:40 »
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 Files

Download 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-bit


Installation Instructions

All 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 Tool

The 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 Mode

When 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 Interpolation

StarAlignment 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 Transformations

To 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 Mode

In 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 Values

Some 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.
« Last Edit: 2009 December 16 02:22:08 by Juan Conejero »
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline ManoloL

  • PixInsight Addict
  • ***
  • Posts: 220
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #1 on: 2009 December 16 00:52:16 »
Hola Juan:
Muchas gracias por las ampliaciones de la herramienta.
En especial notaba la falta de lo que ahora hace: New Register/Union Separate Working Mode
Ayer estuve intentando unir dos encuadres de La California mediante una transición gradual entre ellas a través de una formula en PixelMath y tuve que construirme las dos imágenes a unir, mediante un proceso manual.
Hoy, ahora probaré, las hubiera obtenido directamente:
http://fotografiaastronomica.com/files/posted_images/user_41_formulaunion.jpg

Saludos.
Saludos.

Manolo L.

Offline Jordi Gallego

  • PixInsight Addict
  • ***
  • Posts: 279
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #2 on: 2009 December 16 13:18:12 »
Hola Juan,    english below

Muchas, muchas, gracias por el trabajo desarrollado en esta herramienta. Estos dias voy muy liado de trabajo, pero una prueba rápida me ha mostrado que funciona perfectamente en mosaicos complicados, en los que otros programas han fallado estrepitosamente.
Este fin de semana intentaré poner una pequeña comparativa.

Gracias de nuevo!
Jordi

Hi Juan,

Thank you, thank you very much for the effort on developing this tool. Those days I am very busy, but a quick test has clearly showed me that it works incredibly well on complicated mosaics, where other software packages do fail
This week-end I will try to show a small comparison of results

Thanks again
Jordi
Jordi Gallego
www.astrophoto.es

Offline Yuriy Toropin

  • PixInsight Addict
  • ***
  • Posts: 209
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #3 on: 2009 December 16 14:11: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.
Hi Juan, thanks a lot for this new version!
A minor issue - this release of ImageRegistration has problem registering "reference" image against itself. It was possible in previous version.
While this is a really minor issue and there is a simple workaround that exists for it (don't register the referece image, later just add it to the list of input images for ImageIntegration), it's still the issue that can mimic some real problem.
Regards,
   Yuriy

StarAlignment: Global context
Loading reference image:
D:/Work/c9.fit
Reading FITS: 16-bit integers, 3 channel(s), 3908x2602 pixels: 100%
Extracting CIE L* component: 100%
Structure map: 100%
Detecting stars: 100%
8161 stars found.

...

Registering target image 25 of 25
Loading target file:
D:/Work/c9.fit
Reading FITS: 16-bit integers, 3 channel(s), 3908x2602 pixels: 100%
Extracting CIE L* component: 100%
Structure map: 100%
Detecting stars: 100%
8161 stars found.
Matching stars...
* Reference image: Limiting to 2000 brightest stars.
* Target image: Limiting to 2000 brightest stars.
2000 putative star pair matches.
Performing RANSAC...
*** RANSAC: Unable to find a valid set of star pair matches.
* Previous attempt failed - this is try #2

...


Performing RANSAC...
*** RANSAC: Unable to find a valid set of star pair matches.
* Previous attempt failed - this is try #8
useScaleDifferences=false
* Reference image: Limiting to 500 brightest stars.
* Target image: Limiting to 500 brightest stars.
500 putative star pair matches.
Performing RANSAC...
*** RANSAC: Unable to find a valid set of star pair matches.

<* abort *>

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #4 on: 2009 December 16 14:53:16 »
Hi Juan,

Yes - along with everyone else, you really deserve BIG thanks for the power you have bestowed on the ImageIntegration process - it really has lifted my relatively mediocre DSI-II images up out of the dirt. Now I know that, once calibrated, I can turn to PI and rely on StarAlignment and ImageIntegration to then give me a base image that can actually withstand further processing.

Well done,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #5 on: 2009 December 16 21:38:57 »
Thanks Juan! I'm currently capturing the 6th panel of a mosaic to try this all out. It won't be a beauty with only 30 minutes of integration time per panel but it's more to see if I can make it work then to create art :)
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #6 on: 2009 December 16 21:45:58 »
problem registering "reference" image against itself.
+1

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #7 on: 2009 December 17 02:22:45 »
A minor issue - this release of ImageRegistration has problem registering "reference" image against itself. It was possible in previous version.
While this is a really minor issue and there is a simple workaround that exists for it (don't register the referece image, later just add it to the list of input images for ImageIntegration), it's still the issue that can mimic some real problem.
Regards,
   Yuriy

I can confirm Yuriy's observation.

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Thorsten Lockert

  • Newcomer
  • Posts: 36
    • Personal Home Page
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #8 on: 2010 February 07 12:38:09 »
So is this going to be made available on the new host for those of us that did not get around to downloading it? Or will we have to wait for the next release of PixInsight to have it included?

Thorsten

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #9 on: 2010 February 08 02:23:13 »
Hi Thorsten,

A new version of PixInsight is right now under development, including bug fixes and some important improvements. Among the improvements is a new version of the StarAlignment tool. I think I'll have it ready for release in a week or so.

Anyway, if you have PI version 1.5.9.561 installed then you have the latest (published) version of StarAlignment too.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #10 on: 2010 March 24 13:58:36 »
Juan,

Anyway, if you have PI version 1.5.9.561 installed then you have the latest (published) version of StarAlignment too.

I dont quite understand. 1.5.9.561 was published in November, this updated module is from December 15. So how can the updated module be part of it? Time Warp? ;)

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Updated module: ImageRegistration (2009/12/15)
« Reply #11 on: 2010 March 26 07:17:05 »
Quote
So how can the updated module be part of it? Time Warp?

Dear Georg, unknown the paths of The Force are...  :laugh:
Juan Conejero
PixInsight Development Team
http://pixinsight.com/