PhotometricMosaic (old thread)

jmurphy

Well-known member
A new script to mosaic together previously registered images. It uses photometry to accurately scale the target image. The target image is also corrected for the relative gradient between the two images. This script requires at least one star in the overlapping region.

The PhotometricMosaic script, and two helper scripts (TrimMosaicTile and SplitMosaicTile) are attached, see MosaicScripts.zip.

The help files can be downloaded from:

To produce a seamless join between two aligned frames, it is vitally important that both the brightness scale and the background offset are correct. When multiple frames are combined, accumulative errors make this requirement even more critical. Light pollution gradients create an even greater challenge.

Most mosaic algorithms simply compare the pixel values within the overlap region and use this data to compute the scale and offset. This can work well provided that the images are both of high quality.

Unfortunately, images taken by amateur astrophotographers can suffer from poor seeing. The star FWHM may differ significantly between the two images. For example, on one image the stars may be spread over more pixels. This causes each star's peak value to be significantly lower in this image. Hence if the star profiles differ between the image frames, most mosaic algorithms will fail to accurately calculate the scale difference between the images. The calculated scale can be wildly wrong. An incorrectly calculated scale then causes errors in the calculated background offset level.

To some extent the scale and offset errors cancel each other out but only for a narrow range of pixel values. If the scale is wrong, the two images will end up with different levels of contrast. For example, Milky Way star fields can end up looking less dense in one tile. Or the sky background can look noisier than it should.

The PhotometricMosaic script calculates the scale by using photometry to compare the stars in the overlap region. A least squares fit algorithm is then used to accurately calculate the scale difference. This can produce very accurate results that are resilient against differences in star profiles. The scale is calculated separately for each color channel, so the target frame's color balance will automatically be adjusted to match the reference frame.

The script works best for planned mosaics were the tiles are organized in a grid. For these mosaics, the default parameters should usually work well. Displaying the diagnostic graphs will make it easy to see how to fine tune the parameters.

For ad hoc mosaics, make sure you consult the help files.

reference.PNG
target_with_gradient.PNG

Mosaic.PNG


Dialog.PNG


Diagnostic graph showing the detected gradient:
GradientGraph.PNG



Diagnostic graph showing least squares fit lines and the photometric data points
(there is one outlier point that should be removed):
PhotometryGraphColor.PNG
 
Last edited:
Hi John,

Very nice! Thank you so much for this excellent contribution. Please let me some time to review your code. At any rate, I'd like to include this script in the official distribution, if you agree.
 
Thanks, Juan Conejero
Yes, you are very welcome to include this script in the official distribution.

Once you have reviewed the code, please let me know if there are any improvements I can make. I am keen to learn more about coding for the PixInsight platform.

John Murphy
 
Hi John,

Sure! At first glance I've seen things that we can improve to make your script even better. I'll let you know when I can review your code in depth.
 
Hi Juan
Excellent! I look forwards to hearing your advice and ideas.

Regards John
 
Last edited:
Having spent the weekend testing the script, I noticed a few improvements that could be made...
I have created version 1.1.01, which will be uploaded very soon. It has the following improvements:
  • A better algorithm for matching the reference and target stars, using the star flux and a search window. This increases the number of photometric stars detected in the overlap, which can be very useful for narrow band images. The search window defaults to a 3 pixel radius. It can be set to 1 for dense star fields.
  • Added extra error checks to detect invalid user input.
  • Updated a few tooltips.
  • Fine tuned some of the default settings.
Regards, John Murphy
 
I will try this - I have two wider field panels in a 1 x 2 arrangement on the bluehorsehead that I have drizzled - I have not been able to register them using the normal star align - mosaic approach :(
 
I tested the above using the following flow :
- Image solver
- Mosaic by coordinates
- TrimImage
- Photometric Mosaic.
This was a simple 2 panel to test but everything worked well.
Frederic
 
I tested the above using the following flow :
- Image solver
- Mosaic by coordinates
- TrimImage
- Photometric Mosaic.
This was a simple 2 panel to test but everything worked well.
Frederic

Hi Frederic,
Thanks for the feedback. Testing with data captured using different equipment and during different observing conditions is extremely valuable.
The next version will be available soon (probably within the next week).
Thanks
John Murphy
 
John

This is an amazing tool! Well done and thank you for sharing it (y)
I have been working on a 9 panel mosaic of the Veil Nebula which is 11K x 11K a side...a bit of a masochistic project of mine o_O
After creating the first version of the mosaic (Ha information only so far) using Mosaic by Coordinates and then battling through the dnaLinearFit routine to match image levels and then GradientMergeMosaic....your script was a breeze! :cool:
It not only joined the panels extremely well (I still have to play with my settings but I am being picky), it adjusted the brightness differences across the panels (I knew they were there because of the previous manual procedure) to produce an almost perfect image.
I will try it next once I have enough RGB and OIII information.
Thanks again!

Roberto

N6wWe1XamwZy_1824x0_16kRowki.jpg
 
John

This is an amazing tool! Well done and thank you for sharing it (y)
I have been working on a 9 panel mosaic of the Veil Nebula which is 11K x 11K a side...a bit of a masochistic project of mine o_O
After creating the first version of the mosaic (Ha information only so far) using Mosaic by Coordinates and then battling through the dnaLinearFit routine to match image levels and then GradientMergeMosaic....your script was a breeze! :cool:
It not only joined the panels extremely well (I still have to play with my settings but I am being picky), it adjusted the brightness differences across the panels (I knew they were there because of the previous manual procedure) to produce an almost perfect image.
I will try it next once I have enough RGB and OIII information.
Thanks again!

Roberto

N6wWe1XamwZy_1824x0_16kRowki.jpg
Thank you for your kind words! It is good to know that the script is proving to be useful. Your image of the Veil Nebula is already looking very good.

Was this image created using PhotometricMosaic 1.1, or the latest version 2.1 ? I have made some significant improvements to the script over the last few months, and the scripts now also have a full set of help files in the PixInsight format.

Version 2.1 is available in another thread:

Regards
John Murphy
 
John

I hadn't seen the other thread but downloaded the script from the link at your website and in PixInsight it says it's version 2.1.

Thank you

Roberto
 
John

I hadn't seen the other thread but downloaded the script from the link at your website and in PixInsight it says it's version 2.1.

Thank you

Roberto

That is perfect. You have the latest version. I keep the website up to date, so in some ways it is a good place to get the script from. I have also recently updated the attachments and links on this thread to keep them up to date.

The only problem with the website is it can produce download warnings because it does not like downloading a zip file full of javascript :( (it might depend on which browser is used).

Regards, John
 
Last edited:
John

I have a query about the help files. Where there are two captions e.g. Figure 2 "Using the Blend Mosaic..." am I supposed to be able to view two different images and switch between (1) and (2) by clicking the links? Because this is not working for me.

My browser is Firefox.

Thanks
Peter
 
I have a query about the help files. Where there are two captions e.g. Figure 2 "Using the Blend Mosaic..." am I supposed to be able to view two different images and switch between (1) and (2) by clicking the links? Because this is not working for me. My browser is Firefox.
The image should change when the mouse is placed over the 'link' text. It is triggered by the mouse position, not by a mouse click. You should also see a black triangle to the left of the text which indicates which image is being shown.
1631272986674.png

A screen capture showing the '(2) Mosaic join mode:Blend' image

Note that the reference documentation should be opened from within PixInsight, either via the 'page' button at the bottom of the script dialog, or via the PixInsight 'Process Explorer'
 
Last edited:
Back
Top