Author Topic: Atrous wavlets  (Read 8448 times)

Offline Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Atrous wavlets
« on: 2010 June 29 14:23:30 »
Hi

Ok its time to get dirty  >:D

I want to try and see what Atrous can do and even with playing with it I can't sus it out

So lets start with what I do know

1) layers and scale

Ok thats it  ;D

Lets take it slowley and start with bias it can be a negative or positive number what am I doing by setting this to each layer  ???

Harry
Harry Page

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Atrous wavlets
« Reply #1 on: 2010 June 29 14:32:35 »
This is the one big hairy mystery process that I can't really do anything useful with, it seems.

I imagine it can be used to enhance structures of certain scales. Would it be reasonable for someone to explain the following procedures?

- how to enhance structures of a certain scale (say small scale)
- how to reduce noise in the layer of a certain scale
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 caliu

  • PixInsight Addict
  • ***
  • Posts: 210
    • http://www.caliu.fotografiaastronomica.com
Re: Atrous wavlets
« Reply #2 on: 2010 June 29 21:47:06 »
¿You have tried the Real Time?  :laugh:

Offline RobF2

  • PixInsight Addict
  • ***
  • Posts: 189
  • Rob
    • Rob's Astropics
Re: Atrous wavlets
« Reply #3 on: 2010 June 30 01:27:40 »
Oh goodie.  I'm going to get a pillow and drink and tape recorder.
Be back soon.... ;)
FSQ106/8" Newt on NEQ6/HEQ5Pro via EQMOD | QHY9 | Guiding:  ZS80II/QHY5IIL | Canon 450D | DBK21 and other "stuff"
Rob's Astropics

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Atrous wavlets
« Reply #4 on: 2010 June 30 03:43:14 »
Hi Harry, Sander and Rob,

Quote
Lets take it slowley and start with bias it can be a negative or positive number what am I doing by setting this to each layer

OK let's keep this atrous thing at bay ;D First let's review some important facts about wavelets and wavelet transforms:

- A wavelet layer can be understood as a description of a range of image structures with similar size. We call this a scale, but the word size is more descriptive and sufficiently accurate for our purposes.

- A wavelet transform is a decomposition of an image into several wavelet layers. Such decomposition allows you to isolate different image structures as a function of their relative sizes. You can think of a decomposition as a classification of image structures by their sizes. In the à trous wavelet transform algorithm, layers are defined following a dyadic scaling sequence: 1 pixel, 2 pixels, 4 pixels, ..., 2n-1 pixels.

- A wavelet transform is composed of a set of detail layers and a final residual layer. The residual layer contains all image structures larger than the largest structures in the last detail layer. What we have in the residual layer is only large-scale image features. Usually, when a sufficient amount of detail layers is generated, the residual layer just defines the overall illumination pattern of the image being decomposed.

- A very important property of the à trous wavelet transform algorithm is that the inverse transform is just the sum of all the detail layers plus the residual layer. If you decompose an image and then sum all the layers, what you get is exactly the initial image (neglecting small roundoff errors). You can remove one or more detail layers, that is, exclude them from the inverse transform by not summing them. When you do that, the excluded layers also remove their contained structures from the image. We usually do this to isolate certain image features that we are interested in for some particular task. For example, you can implement a good star mask generation procedure very easily by removing the residual and first layers. Here's an example:

http://pixinsight.com/examples/M45-sonnenstein/en.html

Look at Figures 10, 11 and 12, and read the text around them.

- Another very important property of à trous is that the transformation is redundant: each layer is an image whose dimensions are equal to those of the decomposed image. This is important because, among other nice things, it allows us to work very accurately with the same coordinate system over all wavelet layers.

Now that you know the important facts let's see what we can do with all this stuff. Quick answer: everything. The multiscale paradigm is a completely new way of understanding image processing as a whole. With wavelets you can implement from sharpening to noise reduction, from structure detection to image registration, from texture classification to optical character recognition. Well, almost everything; there are specific tasks that require other mathematical structures that are far more complex, such as curvelets, ridgelets and more -lets, but this is another story (which I want to explore in PixInsight in the future, time and health permitting).

Wavelets are almost omnipresent in PixInsight. You'll find them in many important tools such as ATrousWaveletTransform, HDRWaveletTransform, Deconvolution or StarMask, and others where their use is less obvious such as StarAlignment (star detection and classification), ImageIntegration (noise evaluation), ImageCalibration (dark frame optimization) or LRGCombination (chrominance noise reduction).

But let's return to the topic. As I've said you can disable one or more layers, which just removes them from the inverse transform. For example, the first wavelet layer usually contains most of the small-scale noise (or high-frequency noise) in the image. This happens because small-scale noise occurs mainly at the scale of one pixel, since it is composed of pixel-to-pixel variations. Hence you can disable the first wavelet layer to remove all the small-scale noise in a single operation. Unfortunately, you often can't do that so naively because sharp edges are also small-scale structures, and are also described at the scale of one pixel.

The bias parameter of ATW gives you better control over individual wavelet layers. It allows you to enhance/sharpen (by increasing it) or reduce/blur (by decreasing it) all image structures within a particular wavelet layer. This allows you to change just a set of image features, isolated as a function of their sizes. For example, you usually don't want to increase bias for the first wavelet layer, as doing that would increase the amount of noise in the image horribly. You usually want to increase bias for the second and third layers because they contain little noise and most of the interesting features in the image.

Bias works as a multiplicative factor for a whole wavelet layer. However, instead of implementing it as a simple number that multiplies a layer, I have implemented a balance parameter: when bias is zero, no change occurs (as if the layer were multiplied by one), When bias is positive, all the structures in the layer are multiplied by a number greater than one, and hence they will have more weight in the inverse transform. When bias is negative, the layer is multiplied by a positive number less than one. With this system I can isolate you (the user) from some complexities of the internal implementation, and the balance concept is more intuitive IMO.

The Gibbs phenomenon, AKA ringing, is interesting from a physical and mathematical point of view, but is one of the worst nightmares in practical image processing. When you increase bias, ringing artifacts will appear, inevitably, around all jump discontinuities in the image such as bright stars, bright nebular features, etc. We have implemented a very efficient deringing mechanism for ATW to palliate this problem. Here is an example:

The original image:
http://forum-images.pixinsight.com/1.5-preview/ATW-deringing-1.jpg

A relatively strong bias applied to the second wavelet layer, no deringing:
http://forum-images.pixinsight.com/1.5-preview/ATW-deringing-2.jpg

Same bias, deringing enabled:
http://forum-images.pixinsight.com/1.5-preview/ATW-deringing-3.jpg

The same algorithm has been implemented in other tools, such as UnsharpMask and Deconvolution. Here is a nice example with deconvolution:

Original image:
http://forum-images.pixinsight.com/1.5.2-preview/DeconOriginal.jpg

Without deringing:
http://forum-images.pixinsight.com/1.5.2-preview/DeconNoDeringing.jpg

With deringing:
http://forum-images.pixinsight.com/1.5.2-preview/DeconWithDeringing.jpg

The noise reduction algorithm that I have implemented in ATW is also quite efficient. It has a unique feature that is also a big advantage: it is the only noise reduction algorithm that works with linear images. An example:

Raw (linear) RGB composite image, before noise reduction:
http://forum-images.pixinsight.com/1.5-preview/ATW-noise-reduction-1.jpg

After multiscale noise reduction with ATW:
http://forum-images.pixinsight.com/1.5-preview/ATW-noise-reduction-2.jpg

Something that will probably surprise you is that the above noise reduction has been applied without any protection mask. Pay special attention to the preservation of star colors and subtle details on the main galaxy.

There are much more fancy things that can be done with the ATW tool, but I think this is OK as a general introduction.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Atrous wavlets
« Reply #5 on: 2010 June 30 06:31:27 »
Wow, excellent stuff Juan! I'll review carefully and see if I can craft this into a short demo for MWAIC. The slide-deck is getting a little full and I only have an hour but I'd rather have too much material than too little :)
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 harist

  • Newcomer
  • Posts: 46
Re: Atrous wavlets
« Reply #6 on: 2010 June 30 06:56:02 »
If I understand it correctly scaling function is used for producing the layers and then on each selected layer one can apply:
a. Bias for sharpening or unsharpening each layer's elements combined with deringing for not distorting the sharpened elements (if necessary)
b. noise reduction

Is this the basic functionality of the process or am I missing something important?

BR
Tasos

Offline Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Re: Atrous wavlets
« Reply #7 on: 2010 June 30 13:08:49 »
Hi

A interesting start  :D

I Have found while the deringing  improves things I can not get it to work right accross my images

Even your demo still shows ringing  :P  , how can we improve this

Harry
Harry Page

Offline sleshin

  • PixInsight Old Hand
  • ****
  • Posts: 431
Re: Atrous wavlets
« Reply #8 on: 2010 June 30 16:03:15 »
Juan,

Appreciate you taking the time to write that explanation. Very useful/helpful mini tutorial.

Steve
Steve Leshin

Stargazer Observatory
Sedona, Arizona

Offline dhalliday

  • PixInsight Old Hand
  • ****
  • Posts: 307
    • on Flickr
Re: Atrous wavlets
« Reply #9 on: 2010 July 01 10:11:02 »
Juan
Me too !!
I think if I can just figure this out...........my work is going to go up a level.
That was well presented...even for a  >:D  like me

Dave
Dave Halliday
8" Newtonian/Vixen VC200L/ TV 101,etc etc
SSAG/EQ6
CGE Pro
SBIG ST2K,ST10XME

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Atrous wavlets
« Reply #10 on: 2010 July 02 15:25:10 »
Hi Juan,

I'm fiddling with AWT. It seems that noise reduction also has the potential to remove small structures in the bright areas such as the dust band in the galaxy. I typically prevent this from happening by using a luminance masked ACDNR process instead. Why would I want to use ATW noise reduction on a linear image rather than ACDNR on a stretched image? I like what it does to the noise in the background but it seems the entire image gets softer.

When I tried to apply wavelet bias and deringing on the linear image weird things started happening. I guess that tells me I should only use ATW bias changes on non-linear images?
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 Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Atrous wavlets
« Reply #11 on: 2010 July 02 22:23:28 »
Hi again,

this time I copied your NR settings verbatim and the result was much better. Evidently the the values for threshold, amount and iterations are quite important :) I can imagine what iterations is for but what are threshold and amount? I'd like to give a reasonable explanation for these values at MWAIC and there aren't any tooltips :)

I noticed that when you run ATWT NR on a small image there is a more pronounced Gibbs effect than on larger images. I noticed this while trying to speed up the real time preview by using a smaller preview. That doesn't make the NR look very good. Well, NR is good but the Gibbs effect is undesirable.
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 Harry page

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1458
    • http://www.harrysastroshed.com
Re: Atrous wavlets
« Reply #12 on: 2010 July 02 23:23:55 »
Hi Sander

I am finding that with the gibbs effect the dark setting is very fussy and has to fit your image very well  ;)

I also find when I get the correct setting for say a galaxy, it does not work so well on the surrounding stars  ??? , perhapes mr Juan can help further


Harry
Harry Page

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Atrous wavlets
« Reply #13 on: 2010 July 03 14:52:12 »
Hi Harry,

so you're saying that when doing noise reduction I need to use deringing as well? I thought that was only needed when messing with bias. As an aside, when I'm messing with deringing I've noticed that the rings are either dark or light around the stars. You slide the deringing settings until those rings blend in with the background. The rings don't really protect the background though. It's more of a 'blend' function that makes the rings disappear by making them the same color as the background. That was a little surprising.
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 Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Atrous wavlets
« Reply #14 on: 2010 July 14 18:46:42 »

Hi Juan,

I'm trying to talk about the Atrous process at my MWAIC talk. Tricky as I don't have much experience with it. I figured this would be a good opportunity to try to understand it better. Clearly I don't want to talk about subjects I'm not comfortable with. Mastery would be nice but I don't pretend I have any of that with any PI processes :)

Anyway, I was re-processing an old M31 image. It has reasonable SNR but I wanted to try AWT noise reduction this time instead of stretch->ACDNR which I typically do. I found that the noise reduction does smooth out fine dark structures despite your claim above that it does not. I've tried various combinations but the only NR parameters that didn't touch the dark structures also didn't reduce the noise in the background. Essentially a NOP :)

Here's an example. Raw (linear, DBE, CC) on the left.



My MWAIC sample looks a bit more convincing, perhaps because it's noisier but even there I noticed the hamburger getting affected. I was still drinking the coolaid at the time but not tonight :)

Thanks for any insight you can provide. I imagine the answer is something like "it's hard to differentiate between small scale signal and small scale noise".
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