Author Topic: Gradient Domain Operations, take 3 (was: Gradient Domain HDR Compression)  (Read 33795 times)

Offline RobF2

  • PixInsight Addict
  • ***
  • Posts: 189
  • Rob
    • Rob's Astropics
Great, must play.....
FSQ106/8" Newt on NEQ6/HEQ5Pro via EQMOD | QHY9 | Guiding:  ZS80II/QHY5IIL | Canon 450D | DBK21 and other "stuff"
Rob's Astropics

Offline Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Hi

I am having a play , and I cant get it to work  ??? I know its me sorry

Could you explain the process in a little more detail please  :D

Harry
Harry Page

Offline Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Hi

Ok I have sussed it , but as you say the edges do cause big problems  ???
Harry Page

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Hi Harry,

thanks for the feedback.
- do you get those artefacts only at the borders between different images, or also elsewhere?
- can I have the data to play with?

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

Offline Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Hi

It is just the border / edges I see the problem  >:D

The files are at my FTP server

Harry
Harry Page

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Good morning!

Thanks to Harry for providing me with his data. I think I have found a workaround for the issue:

- Harry's dataset are two images of the North America and the Pelican Nebula.
- Combining them into a mosaic works quite well using PIs StarAlignment process with Linear Fit, see first screenshot on the left.
- If you look closer, you find that Linear fit will still leave some seams, most notably somewhere in the mid-west (Preview 1, first screenshot right).
- Trying to combine using the GradientMergeMosaic process works quite well, except if a star lies just on the boundary of one of the images. In this case, the process produces artefacts as shown in Harry's post on the second screenshot top left.
- Bottom left image illustrates the condition for one of the worst instances.
- Workaround: CloneStamp along the borders, replacing the stars with black background, as shown on the bottom right. Choose softness 0 and opacity 1. I do not consider this "painting", because the contents will be filled in from the other image that does not have a border there.
- Now use GradientMergeMosaic, and you get a perfectly merged mosaic as shown on the top right.

I think what currently is done manually using CloneStamp can be done automatically by some algorithm, but my ideas have not yet converged...

Enjoy,
Georg
« Last Edit: 2011 July 10 05:58:55 by georg.viehoever »
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Hi

Yes I can see how this works as a stop gap , but do not understand how a average of the two images produces these defects , nor am I intelligent enough to tell you how to fix it  ;)

Harry
Harry Page

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Hi Harry,

here is my hypothesis regarding the cause of those artefacts:

- the algorithm first combines images only by overlay (as in StarAlignment) or by average (computing the average where images overlap). At this point, it does nothing to hide the seams - the results are simular to what you see after StarAlignment. The algorithms also generates a mask that identifies which pixel belongs to which image or combination of images (toggle "Generate Mask" to see it).
- It then computes x and y gradients of the combined image. If I would feed this information to the poisson solver, I would get the combined image again - with seams and everything.
- So what I do is first patch the gradients, by setting the gradient to 0 where two image regions meet. Feeding these patched gradients to the solver thus causes the solver to try to give neighboring pixels the same value, thus smoothing out possible seams at this location. Any remaining "tension" is smoothed out over a larger region. Visually, the patched pixels are almost invisible, but the are there...
- Now, if we have a star just at a seam, the star usually causes a strong gradient. The algorithm patches this gradient to be 0. The solver now finds that the core of the star should not be as bright as it currently is, it therefore reduces the core brightness. However, other gradients in the vicinity that are not patched still tell the solver to produce a bright star. So the solver tries to find a compromise between the conflicting gradients, slightly enhancing brightness with respect to the patched gradient, slightly reducing the brightness with regard to the other gradients, and distributing the remaining tension into the neighborhood.

This results in the artifact you see in the screenshot below. I guess the papers I have read about the Gradient Domain algorithms never mentioned this problem because daylight images rarely have the kind of intense points sources that astronomical pictures have.

My current idea to eliminate/reduce those is to limit the gradient patching to regions with low gradients, but I do not yet know if this produces other problems. I think I have also seen some article that suggest how to select optimal seems...but I have not yet found it.

Kind regards,
Georg

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

Offline Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Hi

Thanks for explanation , what you are doing is far more complicated than I first thought  :-[

I am, sure you will have this cracked soon  8)

Harry
Harry Page

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Hi Georg

Why don't you perform the merging right on the gradient domain? I've seen some algorithm of mixed methods, where they take the maximum of the two shots. Maybe a weighted average may do the trick....
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
...Why don't you perform the merging right on the gradient domain? I've seen some algorithm of mixed methods, where they take the maximum of the two shots. Maybe a weighted average may do the trick....

That's indeed probably the path I will take. Stay tuned...

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

Offline gvanhau

  • PixInsight Old Hand
  • ****
  • Posts: 345
Hello
I Was testing this on some old mosaic candidate images.
In general it worked better than the linear fit. but... I got this pair of images on witch I got no match...
I tried using  both options Average and Overlay.

Regards
Geert
Geert Vanhauwaert

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Hi Geert,
thanks for trying this module. Practical experience is most valuable to improving this module.

With regard to the images that just do not match: my idea would be that something is strange at the border of those images.
- could you provide me with copies of those images?
- can you try to cut away a couple of pixels at the border of images (where you see the underdesired effect), and then try gradient merge mosaic again?

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

Offline gvanhau

  • PixInsight Old Hand
  • ****
  • Posts: 345
 Georg it was my fault.
The bottom image had  a dark line near the top that only was visible in 1x

the results are really very good.

Regards
Geert
Geert Vanhauwaert

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
This was indeed the type of problem that I expected. The next release will contain a workaround for this.
Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)