PhotometricMosiac 4.0

Thanks for pointing me in the right direction, John. I will give it a try--my old MBP only runs on 8 GB. Sorry to be too lazy to read the whole thread, or I might have actually caught your solution without your having to repeat it!

I have been singing your praises on the Beginning DSO Imaging forum on CloudyNights--hopefully more people will find how easy you have made it to create superb mosaics. (Well, the making is superb--whether the material going into them is superb is another issue! ) Thanks again for all the work you put into this and the advice you give.

Just tried the work-around suggested and all is good! Again, thanks!
 
Last edited:
I have been singing your praises on the Beginning DSO Imaging forum on CloudyNights--hopefully more people will find how easy you have made it to create superb mosaics. (Well, the making is superb--whether the material going into them is superb is another issue! ) Thanks again for all the work you put into this and the advice you give.

Just tried the work-around suggested and all is good! Again, thanks!
:)
 
Hi John,

I ran into a bug (user error flop?) while attempting to stitch together four high-resolution panels for stars, HDR combine, etc. on the Orion Nebula project I’m working on at the moment.

Attached is one example with a very strong green flash between two connected panels. I ran into similar issues combining luminance panels (combining two panels together, or in stitching the combined sides). I followed the general steps described in pre-processing and used the associated tools, with the exception of using some creative work-arounds to manage light gradients as I wanted to drizzle the data (not output directly from Normalize Scale Gradient). The mild light gradients were removed with DBE.

Also attached are the two panels shown above illustrating what that seam looks like outstretched.

The final mosaic, for context, is 20000px wide and some 15000px tall. The process seemed to run without error and the computer has, I think, plenty of resources (maxed out 2022 MacBook Pro).

I used Photometric Mosaic 3.4.2 (as included in the PixInsight distribution). I hopped back in the history here, and saw a similar issue early on. And saw 3.4.3, but it doesn’t look like this was associated with a recent bug fix?

I did get this data stitched together using GradientMergeMosaic (painfully), but thought I’d ask about this before it slipped my memory, as your tool is my preferred solution. And all the better if I can help with a potential bug.

Thank you,
James
 

Attachments

  • mosaic_green_eg.jpg
    mosaic_green_eg.jpg
    965.5 KB · Views: 113
  • mosaic_eg_2.jpg
    mosaic_eg_2.jpg
    516.2 KB · Views: 108
Hi John,

I ran into a bug (user error flop?) while attempting to stitch together four high-resolution panels for stars, HDR combine, etc. on the Orion Nebula project I’m working on at the moment.

Attached is one example with a very strong green flash between two connected panels. I ran into similar issues combining luminance panels (combining two panels together, or in stitching the combined sides). I followed the general steps described in pre-processing and used the associated tools, with the exception of using some creative work-arounds to manage light gradients as I wanted to drizzle the data (not output directly from Normalize Scale Gradient). The mild light gradients were removed with DBE.

Also attached are the two panels shown above illustrating what that seam looks like outstretched.

The final mosaic, for context, is 20000px wide and some 15000px tall. The process seemed to run without error and the computer has, I think, plenty of resources (maxed out 2022 MacBook Pro).

I used Photometric Mosaic 3.4.2 (as included in the PixInsight distribution). I hopped back in the history here, and saw a similar issue early on. And saw 3.4.3, but it doesn’t look like this was associated with a recent bug fix?

I did get this data stitched together using GradientMergeMosaic (painfully), but thought I’d ask about this before it slipped my memory, as your tool is my preferred solution. And all the better if I can help with a potential bug.

Thank you,
James
Hi James
PhotometricMosaic does have a bit of a learning curve, so it is necessary to read the Quick Start Guide. However, once you have learnt how to use it, I believe that, for mosaics that form a regular grid, it can out perform any mosaic software currently on the market.

The most common mistake is a non black area surrounding the registered images. This can happen after applying DBE. You will need to apply PixelMath to remove this. The background needs to be totally black (zero). Then use TrimMosaicTile to ensure hard edges (it is usually necessary to remove a few pixels from all edges). I think this will solve your problem.

The next most common problem is the order the mosaic joins are made. PhotometricMosaic can only merge one join at a time, so it cannot add a corner tile. Instead, the mosaic must first be constructed with either rows or columns. Then the resulting strips are joined.

If this does not work, let me know and I will provide more help.
John Murphy

Thanks for your https://ko-fi.com/jmurphy donation. Most appreciated :)
 
Hi James
PhotometricMosaic does have a bit of a learning curve, so it is necessary to read the Quick Start Guide. However, once you have learnt how to use it, I believe that, for mosaics that form a regular grid, it can out perform any mosaic software currently on the market.

The most common mistake is a non black area surrounding the registered images. This can happen after applying DBE. You will need to apply PixelMath to remove this. The background needs to be totally black (zero). Then use TrimMosaicTile to ensure hard edges (it is usually necessary to remove a few pixels from all edges). I think this will solve your problem.

The next most common problem is the order the mosaic joins are made. PhotometricMosaic can only merge one join at a time, so it cannot add a corner tile. Instead, the mosaic must first be constructed with either rows or columns. Then the resulting strips are joined.

If this does not work, let me know and I will provide more help.
John Murphy

Thanks for your https://ko-fi.com/jmurphy donation. Most appreciated :)
Hi John,

Thank you. I think it's the PixelMath step that I missed. I did use DBE (subtraction), the background was black, and I did use TrimMosaicTile. I haven't gone back and re-created the mosaic to be sure, but that's one step which I've used before which I skipped this time. On previous occasions I've referenced the help guide as I've used the tool, but this time I thought I'd just quick reference the steps listed at the top of the script window and go through the process "faster."

After this, I'll remember next time. But out of curiosity, if such a step tends to be integral to successful operation of the tool, is it something that might be worked into the tool itself? A PixelMath step mentioned in the documentation is a fairly obscure failure point in correlation with a commonly used feature like DynamicBackgroundExtraction.

Regardless, thanks again!
 
I am trying to stitch together a 4 panel mosaic of the Heart Nebula. I can use Photometric Mosaic to stitch panels 1&2 and 3&4 but whenever I try to stitch together panels 3 into the mosaic of 1/2 or the other way, I get a PixInsight segmentation violation:

1646238863927.png


Any thoughts?
 
I am trying to stitch together a 4 panel mosaic of the Heart Nebula. I can use Photometric Mosaic to stitch panels 1&2 and 3&4 but whenever I try to stitch together panels 3 into the mosaic of 1/2 or the other way, I get a PixInsight segmentation violation:

View attachment 13829

Any thoughts?
I am guessing that you are using Mac OS with 16 GB of memory or less. Under these conditions, the PixInsight C++ SurfaceSpline function can fail.

@Juan Conejero suspects that this is a MAC OS Clang compiler bug. The problem has been reproduced on 8 GB and 16 GB systems, but so far has worked OK on systems with more memory.

The work around is described here:

Regards, John Murphy
 
@jmurphy Thanks for the quick reply. Reducing the number of maxSamples allowed me to complete the joining of the parts. I had tried a few different approaches, even trying to crop the two merged panels and reapply the Mosaic but that also failed the same way.
 
Please use .xisf compression when saving the images. The black areas compress really well.
Hello, how do I tell your script to save as using compression for bulk runs? the reswindow.saveas part of the script does not appear to have any way to specify the compression type?
 
Saving an image with lossless compression is built into PixInsight, provided that you use the '.xisf' format:
1652690006499.png

You just need to select the 'XISF Data Block Compression' option when you save the image.

Hope this helps, John Murphy
 
Hi there John, just wanted to get your thoughts on these quadrants seemingly disappearing? The overlap
seems to have been calculated correctly and the images should be a walk in the park is there's tons
of overlap and they are on the same row....These have all been though Image Solver and Mosaic By Coords...

Any thoughts appreciated thanks !
Casey


1657153900419.png
 
Hi there John, just wanted to get your thoughts on these quadrants seemingly disappearing? The overlap
seems to have been calculated correctly and the images should be a walk in the park is there's tons
of overlap and they are on the same row....These have all been though Image Solver and Mosaic By Coords...

Any thoughts appreciated thanks !
Casey


View attachment 15156
This issue is explained in PhotometricMosaic's Reference documentation.
See section 1.6 Tutorial: Staggard Join
The script is designed for planned mosaics that consist of tiles taken in a regular grid. In your case the two tiles are staggered. This requires you to do a bit of extra preparation work while creating the mosaic. Hopefully you will understand how to do this from the documentation. If not, get back to me and I will help.
Regards, John Murphy
[Edit: it's not what I initially thought. See my next message.]
 
Last edited:
I have had another look at your tiles, and the situation is not quite what I thought. In your case, the problem is down to the very large almost square overlap. This has confused the script; it has wrongly assumed that it is joining a vertical column with a top and bottom tile.
The best way to solve this is to either use SplitMosaicTile or PixelMath to reduce the width of the join. As soon as the join area is taller than it is wide, PhotometricMosaic will stop being confused.
Regards, John Murphy
 
Got it I will try that now, I had read that part and was just about to say that these are about as grid-like as you can get:

1657229323160.png



But I did go overboard on the overlap and I can see programmatically how the aspect ratio of the overlap region might confuse the script as to whether it's a horizontal or vertical join..... I'll let you know how it goes :)
 
Bingo! That did it.....

I ended up simply using the clone tool to erase the excessive overlap, and you can see that your calculated green overlap
rectangle is much taller than wide which is likely what your code wants to confirm which border/direction...

1657229905817.png


Might be handy to add a checkbox for the user to force horizontal or vertical join? Not a major but just a thought......

Anyway this script is remarkable as is NSG. Thanks !
Casey
 
I was always a bit worried about having too many controls, but yes, I think an extra group of orientation radio buttons would help:
* Auto (calculated from overlap proportions)
* Top Bottom (horizontal join)
* Left Right (vertical join)

Using the clone stamp to reduce the size of overlap is OK, but you need to be careful not to place the join too near the clone stamped edge. The reason for this is that the clone stamp is slightly soft even on its hardest setting. If this was included in the mosaic, the soft edge could be visible as a faint line. If the whole overlap area is needed, it is better to use PixelMath or SplitMosaicTile. For example:
iif(x() < 300, 0, $T) (replace 300 with your edge value, use '>' for right hand edge)
Regards, John Murphy
 
Hello!
I'm having a problem stitching together 9 panels.

What happens is, it stitches the first 3 next to each other together, but when I start the next row, it deletes the last panel. If I add another, again- it deletes another panel while stiching the new one. I've been trying to figure out and I went and tried 4 times already with different ideas - even creating 2 separate mosaics and stitch those together but doesn't work either. It attaches the next panel but deletes another.

Notice on the images below, that 3 panels stitched in a row. When I added the next below, it worked, but removed the last on the far right.

All the 9 panels are mosaic-trimmed, imagesolved; and ran through mosaic-by coordinates process. So they all look like they are placed correctly on the black background where they should go.

Also, someone please point me to the help files and tutorials , because I can't figure out where the tutorials and instructions located. Is it inside my pixinsight? Is it on the web?
 

Attachments

  • mosaic4.JPG
    mosaic4.JPG
    354.2 KB · Views: 69
  • mosaic6.JPG
    mosaic6.JPG
    477.6 KB · Views: 70
Last edited:
Running into this error:

*** Error [000]: C:/Program Files/PixInsight/src/scripts/JohnMurphy/mosaic/src/lib/Gradient.js, line 512: Error: Image.getSamples(): insufficient array elements

Here is the full listing:

=== Photometric Mosaic 3.4.3 ===



Reference: Mosaic5, Target: Mosaic6



Calculating overlap

OverlapImage:

channel #0

c0 = 0.006285

m = 0.073035

c1 = 1.000000

channel #1

c0 = 0.006285

m = 0.073035

c1 = 1.000000

channel #2

c0 = 0.006285

m = 0.073035

c1 = 1.000000



ScreenTransferFunction: Processing view: OverlapImage

771.000 us





HistogramTransformation: Processing view: OverlapImage

Processing channel #0:

LUT-based histogram transformation: done

Processing channel #1:

LUT-based histogram transformation: done

Processing channel #2:

LUT-based histogram transformation: done

128.906 ms

OverlapImage1:

channel #0

c0 = 0.004458

m = 0.090700

c1 = 1.000000

channel #1

c0 = 0.004458

m = 0.090700

c1 = 1.000000

channel #2

c0 = 0.004458

m = 0.090700

c1 = 1.000000



ScreenTransferFunction: Processing view: OverlapImage1

683.600 us





HistogramTransformation: Processing view: OverlapImage1

Processing channel #0:

LUT-based histogram transformation: done

Processing channel #1:

LUT-based histogram transformation: done

Processing channel #2:

LUT-based histogram transformation: done

122.291 ms

10.668 s



Detecting stars

Detecting stars: Reference detected 4817 stars

Detecting stars: Target detected 2911 stars

8.73 s



Displaying photometry stars



Displaying photometry graph



Displaying target image gradient graph



Calculating scale

Surface spline (Luminance 2949 samples, 3.0 smoothness, 1.373 s)



Calculating scale

Scaling Mosaic6[0] by (1.1324 x 1.0000) (1774 stars)



Calculating surface spline

Reduced number of samples from 32960 to 2949

Surface spline (Luminance 2949 samples, 3.0 smoothness, 1.395 s)

Surface spline (Luminance 2949 samples, -1.0 smoothness, 1.368 s)



Creating Mosaic

Use [Ctrl+k] to show/hide the join mask.

Reference [0] 72%

*** Error [000]: C:/Program Files/PixInsight/src/scripts/JohnMurphy/mosaic/src/lib/Gradient.js, line 512: Error: Image.getSamples(): insufficient array elements



run --execute-mode=auto "C:/Program Files/PixInsight/src/scripts/JohnMurphy/mosaic/src/PhotometricMosaic.js"



Processing script file: C:/Program Files/PixInsight/src/scripts/JohnMurphy/mosaic/src/PhotometricMosaic.js




I am running the latest version I believe.
 
Running into this error:

*** Error [000]: C:/Program Files/PixInsight/src/scripts/JohnMurphy/mosaic/src/lib/Gradient.js, line 512: Error: Image.getSamples(): insufficient array elements

Here is the full listing:

=== Photometric Mosaic 3.4.3 ===

Reference: Mosaic5, Target: Mosaic6

Calculating overlap

OverlapImage:

channel #0
c0 = 0.006285
m = 0.073035
c1 = 1.000000

channel #1
c0 = 0.006285
m = 0.073035
c1 = 1.000000

channel #2
c0 = 0.006285
m = 0.073035
c1 = 1.000000

ScreenTransferFunction: Processing view: OverlapImage
771.000 us

HistogramTransformation: Processing view: OverlapImage
Processing channel #0:
LUT-based histogram transformation: done
Processing channel #1:
LUT-based histogram transformation: done
Processing channel #2:
LUT-based histogram transformation: done
128.906 ms

OverlapImage1:

channel #0
c0 = 0.004458
m = 0.090700
c1 = 1.000000

channel #1
c0 = 0.004458
m = 0.090700
c1 = 1.000000

channel #2
c0 = 0.004458
m = 0.090700
c1 = 1.000000

ScreenTransferFunction: Processing view: OverlapImage1
683.600 us

HistogramTransformation: Processing view: OverlapImage1
Processing channel #0:
LUT-based histogram transformation: done
Processing channel #1:
LUT-based histogram transformation: done
Processing channel #2:
LUT-based histogram transformation: done
122.291 ms
10.668 s

Detecting stars
Detecting stars: Reference detected 4817 stars
Detecting stars: Target detected 2911 stars
8.73 s

Displaying photometry stars
Displaying photometry graph
Displaying target image gradient graph

Calculating scale
Surface spline (Luminance 2949 samples, 3.0 smoothness, 1.373 s)

Calculating scale
Scaling Mosaic6[0] by (1.1324 x 1.0000) (1774 stars)

Calculating surface spline
Reduced number of samples from 32960 to 2949
Surface spline (Luminance 2949 samples, 3.0 smoothness, 1.395 s)
Surface spline (Luminance 2949 samples, -1.0 smoothness, 1.368 s)

Creating Mosaic

Use [Ctrl+k] to show/hide the join mask.

Reference [0] 72%

*** Error [000]: C:/Program Files/PixInsight/src/scripts/JohnMurphy/mosaic/src/lib/Gradient.js, line 512: Error: Image.getSamples(): insufficient array elements

run --execute-mode=auto "C:/Program Files/PixInsight/src/scripts/JohnMurphy/mosaic/src/PhotometricMosaic.js"
Processing script file: C:/Program Files/PixInsight/src/scripts/JohnMurphy/mosaic/src/PhotometricMosaic.js


I am running the latest version I believe.
Sorry about the delay in replying. We have just been through a record breaking hot period in the UK, and we are not used to it! It has been too hot to concentrate.

Would you be able to send me a link to the two mosaic tiles that caused the problem? Please save them with .xisf compression. This is lossless, and the black areas compress really well. I will look into it as soon as the images are available.
Regards,
John Murphy
 
Sorry about the delay in replying. We have just been through a record breaking hot period in the UK, and we are not used to it! It has been too hot to concentrate.

Would you be able to send me a link to the two mosaic tiles that caused the problem? Please save them with .xisf compression. This is lossless, and the black areas compress really well. I will look into it as soon as the images are available.
Regards,
John Murphy
Thank you for getting back to me. You can visit here in Mallorca if you feel the heat! ;)
Somehow I was able to overcome the error by pairing the tiles in columns instead of rows. It is a rather large mosaic of 54 (6x9) panels and the light pollution runs in such a way that the columns are more closely matched. Maybe that was the issue?

BTW, I couldn't thank you enough for your work.
 
Last edited:
Back
Top