New PhotometricMosaic Script

jmurphy

Active member
Jun 13, 2010
30
11
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
 

Attachments

Last edited:
  • Like
Reactions: rbotero

jmurphy

Active member
Jun 13, 2010
30
11
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
 

jmurphy

Active member
Jun 13, 2010
30
11
Hi Juan
Excellent! I look forwards to hearing your advice and ideas.

The javascript source is also available on github to make it easier for people to make contributions:

Regards John
 

jmurphy

Active member
Jun 13, 2010
30
11
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
 

greendaleobs

Member
Jun 18, 2019
12
0
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 :(
 

freed

Well-known member
Mar 6, 2017
64
1
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
 

jmurphy

Active member
Jun 13, 2010
30
11
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
 

rbotero

Active member
Jan 19, 2005
44
3
Kent, England
www.astrobin.com
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

 
  • Like
Reactions: pfile

jmurphy

Active member
Jun 13, 2010
30
11
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

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
 
  • Like
Reactions: jiberjaber

jmurphy

Active member
Jun 13, 2010
30
11
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:
  • Like
Reactions: rbotero