PixInsight Forum (historical)

PixInsight => Tutorials and Processing Examples => Topic started by: ManuelJ on 2012 March 28 03:13:44

Title: Deconvolution strategies
Post by: ManuelJ on 2012 March 28 03:13:44
Hi,

I have added this new tutorial to my web. If you have any comments or questions, please contact me!

http://www.manuelj.com/Tutorials/Deconvolution

Regards,
Manuel.
Title: Re: Deconvolution strategies
Post by: Philippe B. on 2012 March 28 05:03:15
Very useful, thank you for sharing !

How do you create your 2 masks ?
- 1rst one with bright stars only
- 2nd one with High SNR
Do you use StarMask function or another one ?

Why don't you use a generated PSF star for the deconvolution ?

Thank you, it is really helpful to understand another way to process ! And how deep can be PI processing steps
Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 March 28 05:49:58
Very useful, thank you for sharing !

How do you create your 2 masks ?
- 1rst one with bright stars only
- 2nd one with High SNR
Do you use StarMask function or another one ?

Why don't you use a generated PSF star for the deconvolution ?

Thank you, it is really helpful to understand another way to process ! And how deep can be PI processing steps

Hi,

I left open for the implementation to use, but in my case:

1) bright stars -> star mask
2) high SNR -> clone and histogram transform

I don't use the generated PSF because it tends to be greater than the manually calculated StdDev, so it tends to create ringing artifacts.

Regards,
Manuel.
Title: Re: Deconvolution strategies
Post by: Nocturnal on 2012 March 28 06:20:29
Thanks! Will study this soon.
Title: Re: Deconvolution strategies
Post by: Nocturnal on 2012 March 28 17:03:01
This looks really excellent. At the end you seem to suggest that deconv should be executed on linear images. I think that's correct. If so perhaps you could add that at the beginning of the tutorial?
Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 March 29 02:34:30
This looks really excellent. At the end you seem to suggest that deconv should be executed on linear images. I think that's correct. If so perhaps you could add that at the beginning of the tutorial?

Thanks!, I'll add that.
Title: Re: Deconvolution strategies
Post by: Juan Conejero on 2012 March 29 04:37:32
Hola Manuel,

Nice tutorial. I see you are using average PSF parameters taken from the Average Star Data dialog. This is not recommended for deconvolution. A more robust and accurate PSF can be obtained by clicking the Export synthetic PSF button of DynamicPSF. The synthetic PSF image can be selected on the Deconvolution tool as an external PSF. Let me know if this works better for you.
Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 March 29 06:17:45
Hola Manuel,

Nice tutorial. I see you are using average PSF parameters taken from the Average Star Data dialog. This is not recommended for deconvolution. A more robust and accurate PSF can be obtained by clicking the Export synthetic PSF button of DynamicPSF. The synthetic PSF image can be selected on the Deconvolution tool as an external PSF. Let me know if this works better for you.

No, that's what I use, the synthetic PSF image has a bigger StdDev (around 1.80) than my sweet spot one (around 1.20-1.30).

Although DPSF helps me to calculate the rotation angle and the amount of tilting of my stars

Regards,
Manuel.
Title: Re: Deconvolution strategies
Post by: sleshin on 2012 March 29 11:46:19
Manuel, that's a well done tutorial that will be widely appreciated.

A couple of  comments.

1. In step 2 where you show the "High SNR Mask", applied to the image, the mask is inverted so it will have the opposite effect you are trying to achieve. Red pixels are protected and black unprotected so as shown, the background ie the lowest SNR area is getting most of the decon effect and the highest SNR areas in the galaxy where you want most of the deconvolution is protected. Just invert the mask so the background is red and the galaxy white.

2. To control deringing, I have found that perhaps the most important setting is the "Global Dark" The default value of 0.1 is always too high. I generally find 0.01 to 0.03 is the range required.

3. Philippe. To create the bright star mask to be used as the Local Support image in the deringing section, use the Star Mask tool with the default settings and apply it to the linear image you are going to deconvolve. This was the recommendation Juan made in a mini tutorial on decon he posted some time ago. In the resulting mask I find that a number of the stars are grey rather than white which means they will only be partially  protected. I will sometimes create this mask with Binarize checked in the Star Mask tool. The resulting mask will have the same stars but they'll be mostly white and therefore provide better protection. BTW, I find that this mask which selects the largest and brightest stars is also useful later in processing when you want to work on just these stars. The larger and brighter stars frequently are the ones you want to change with the Morph Transform tool. So, I always save this mask and use it for things in addition to decon.

Steve
Title: Re: Deconvolution strategies
Post by: Juan Conejero on 2012 March 30 01:15:21
Manuel,

Quote
No, that's what I use, the synthetic PSF image has a bigger StdDev (around 1.80) than my sweet spot one (around 1.20-1.30).

This is usually the expected result. The sweet spot of your telescope is a laboratory-determined spatial resolution limit. To deconvolve real deep sky images you don't want to use your sweet spot as a PSF model, but usually something larger. Or maybe we have different concepts of what the sweet spot is about---and in such case please correct me.

The PSF model that you use with deconvolution should be an accurate representation of the true point spread function that has damaged your image as a result of atmospheric turbulence, optical imperfections, tracking errors and other accidents. The profile of this function is usually larger than the sweet spot of your optical system, and in your case (focal length, pixel size) its dimensions are basically dominated by your seeing conditions.

Also bear in mind that FWHM values are in general not compatible among different PSF model functions. For example, if your PSF has a Moffat profile with a relatively large beta parameter (say from 4 to 8), then FWHM values will be systematically larger than those that you'd find by adjusting a Gaussian profile (shape parameter = 2 in the parametric function). However, a Moffat function will probably model your true PSF better than a Gaussian because the Moffat has extended 'tails' that tend to represent better the actual shape of a typical star profile, especially on oversampled images.

Average parameters are very sensitive to outliers, which are due to uncertainties caused by limited signal to noise ratio. Rotation angle and aspect ratio are two particularly sensitive and uncertain parameters.

The synthetic PSF model is more accurate and much more robust than a function reconstructed from average fitted parameters. This is because the synthetic PSF image is generated by projecting all measured PSF functions over a black background. The process is similar to what you'd obtain by taking an exposure of each measured star with an ideal sensor (zero noise, enough full well as to accumulate all star images without saturation) centered at the same pixel. Provided that a sufficient number of representative stars have been correctly measured on the image, a synthetic PSF should be better than anything that you can find by manually tweaking function parameters.
Title: Re: Deconvolution strategies
Post by: Nocturnal on 2012 March 30 06:23:00
So it sounds like Manual could show us two images, one processed with a synthetic PSF and one with one derived from the image. It could be that the synthetic PSF gives better results.
Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 March 31 07:06:03
So it sounds like Manual could show us two images, one processed with a synthetic PSF and one with one derived from the image. It could be that the synthetic PSF gives better results.

Manuel!!!

http://www.manuelj.com/Other/Projects/i-Psf2Rz5/0/O/Image29.jpg

I really prefer my version, it has the most round stars, and looks more natural to me. The DPSF version has black halos, and correcting them with global dark creates bright artifacts. What would you choose? :)
Title: Re: Deconvolution strategies
Post by: vicent_peris on 2012 March 31 07:15:46
Hi Manu(a)el!

Please cloud you share the settings of the deconvolution processes (or a process icon)? Have you applied the same deconvolution process to all the images? What do you mean by "global dark adjusted"?


Regards,
Vicent.
Title: Re: Deconvolution strategies
Post by: Nocturnal on 2012 March 31 07:44:49
I agree with your assessment Manuel.
Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 March 31 12:49:49
Hi Manu(a)el!

Please cloud you share the settings of the deconvolution processes (or a process icon)? Have you applied the same deconvolution process to all the images? What do you mean by "global dark adjusted"?


Regards,
Vicent.

Yes, my captain!.

I applied the same settings for all deconvolutions, except the P.deringingDark, which was 0.03 on the last image. This is the value where dark rings starts to disappear.

var P = new Deconvolution;
P.algorithm = Deconvolution.prototype.RichardsonLucy;
P.numberOfIterations = 50;
P.deringing = true;
P.deringingDark = 0.0000;
P.deringingBright = 0.0000;
P.deringingSupport = true;
P.deringingSupportAmount = 0.70;
P.deringingSupportViewId = "star_mask";
P.toLuminance = true;
P.psfMode = Deconvolution.prototype.Parametric;
P.psfSigma = 1.30;
P.psfShape = 2.00;
P.psfAspectRatio = 0.49;
P.psfRotationAngle = 35.00;
P.psfMotionLength = 5.00;
P.psfMotionRotationAngle = 0.00;
P.psfViewId = "PSF";
P.psfFFTSizeLimit = 15;
P.useRegularization = true;
P.waveletLayers = [ // noiseThreshold, noiseReduction
   [3.00, 1.00],
   [2.00, 0.30],
   [1.00, 0.70],
   [1.00, 0.70],
   [1.00, 0.70]
];
P.noiseModel = Deconvolution.prototype.Gaussian;
P.numberOfWaveletLayers = 2;
P.scalingFunction = Deconvolution.prototype.B3Spline5x5;
P.convergence = 0.0000;
P.rangeLow = 0.0000000;
P.rangeHigh = 0.0000000;
P.iterations = [ // count
   [50],
   
Title: Re: Deconvolution strategies
Post by: vicent_peris on 2012 April 01 12:56:59
Hi,

Have you tried to apply more iterations with the process with the synthetic PSF generated by DPSF? In my experience it needs more iterations but usually works pretty well. Try with 100 - 200... Of course, having a PSF with a larger StdDev you'll have more ringing... I try to correct them partially with the global options and use the maks to correct the stronger ones.


Regards,
V.
Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 April 02 00:20:13
Hi,

Have you tried to apply more iterations with the process with the synthetic PSF generated by DPSF? In my experience it needs more iterations but usually works pretty well. Try with 100 - 200... Of course, having a PSF with a larger StdDev you'll have more ringing... I try to correct them partially with the global options and use the maks to correct the stronger ones.


Regards,
V.

Yes, maybe I have to improve my masks. I don't like the effects of the global options on the data, it tends to create ringing artifacts. One small touch is ok, but if your black halos are quite evident, global options is not the only way to go.

Regards,
Manuel.
Title: Re: Deconvolution strategies
Post by: viktorbravo on 2012 April 20 21:31:55
Thanks for a great tutorial Manuel.  I agree that I like the image better with your PSF.  With the synthetic PSF the image looks, well, more synthetic.

I found that generating the ideal masks are quite time consuming for me.  However with a little more practice I should get quicker at it.

Vince
Title: Re: Deconvolution strategies
Post by: niteman1946 on 2012 May 05 15:19:17
Hi Manuel,

This is a good tutorial and thanks for posting it.

With this guide I was able to produce quality images using Decon for the first time.

Appreciate your good effort.

Mark

Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 May 07 07:38:45
I'm glad that this is useful for you, guys.
Title: Re: Deconvolution strategies
Post by: Lex on 2012 May 08 12:18:19
Yep indeed, huge thanks again! You're the man Manuel  8)
Title: Re: Deconvolution strategies
Post by: Raymond on 2012 May 08 13:42:50
Hi Manuel
Thanks a lot for this very instructive tutorial.
I tried your workflow for one of my images and some questions appeared:
1. If during deconvolution the message appears 'local divergence at iteration ...', does this mean that some parameters have to be changed, or is this not fatal for the processing?
2. After deconvolution, small dark rings appear around some stars. With 'global dark = 0.0030' these dark rings disappeared. Is this the correct approach?
3. The background is protected by a mask. But in my image, the appearance of the background changes slightly comparing before/after deconvolution. Using the script Noise Evaluation, the noise raises by about 2%. Is this normal, or is the applied mask not correct?
Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 May 08 23:52:41
Hi Manuel
Thanks a lot for this very instructive tutorial.
I tried your workflow for one of my images and some questions appeared:
1. If during deconvolution the message appears 'local divergence at iteration ...', does this mean that some parameters have to be changed, or is this not fatal for the processing?
2. After deconvolution, small dark rings appear around some stars. With 'global dark = 0.0030' these dark rings disappeared. Is this the correct approach?
3. The background is protected by a mask. But in my image, the appearance of the background changes slightly comparing before/after deconvolution. Using the script Noise Evaluation, the noise raises by about 2%. Is this normal, or is the applied mask not correct?

Hi,

1. No problem
2. There is two ways, lower the stddev or correcting with global dark, experiment and see what looks best to you. If find always better to trick the stddev.
3. Try to protect the background better. Apply a shadows cut in the mask histogram.

Regards,
Manuel.
Title: Re: Deconvolution strategies
Post by: Raymond on 2012 May 09 04:28:55
Manuel, thanks for your explanations!
Title: Re: Deconvolution strategies
Post by: Silvercup on 2012 May 09 07:15:56
There are a few tricks that we must take into account.

If I have time I'll try to explain, making an extensive tutorial about deconvolution for both planetary and deep sky images.

Silvercup
Title: Re: Deconvolution strategies
Post by: mmirot on 2012 May 12 07:56:17
Nice tutorial

Should not the high SNR mask be named low SNR? It is masking/protecting the the low SNR background.

Perhaps sampling the center 50 percent using the DPSF would give better results. The information you want improve is often central and less effect by off axis effects. The psf model might be skewed depending on the optics leading to bloated model

Max
Title: Re: Deconvolution strategies
Post by: Geoff on 2012 May 29 00:58:38
Hola Manuel
Let me see if I have this correct.  When you say "Protect the original image with the mask", the mask you are referring to is the high SNR mask.  The star mask is used only in the local deringing panel and is never explicitly applied to the image.
Thanks for the tutorial; it brings a lot of things together.
Geoff
Title: Re: Deconvolution strategies
Post by: ManuelJ on 2012 May 29 02:19:31
Hola Manuel
Let me see if I have this correct.  When you say "Protect the original image with the mask", the mask you are referring to is the high SNR mask.  The star mask is used only in the local deringing panel and is never explicitly applied to the image.
Thanks for the tutorial; it brings a lot of things together.
Geoff

You're right!.

Regards,
Manuel.
Title: Re: Deconvolution strategies
Post by: gvanhau on 2012 August 21 20:46:16
Thanks Manuel

Al least for me, this tutorial was very usefull.

Regards
Geert
Title: Re: Deconvolution strategies
Post by: niteman1946 on 2012 August 22 05:27:12
Thanks again Manuel.

I've since migrated back to Juan's method of using the synthetic PSF.  For me it appears to do no worse, and is quicker than using the manually calculated stddev.  Global Dark adjustment (usually around .005 for nebulae) has become my favorite tweek.

Notwithstanding that, you got me going in the right direction, and I routinely use Decon for all my images.

Mark
Title: Re: Deconvolution strategies
Post by: Jim_ on 2012 October 01 15:00:56
I have a quick question...when I take my reading off the DPSF, sometimes it shows my Rotation value as a negative number.
Since I'm still VERY new to the software and haven't figured out how it works yet, would I put the number in as a positive number or would I need to subtract it from either 90 or 180?

Jim
Title: Re: Deconvolution strategies
Post by: pfile on 2012 October 01 15:55:04
just uncheck "use signed angles" in the DynamicPSF process and you'll get angles you can use.

then again you can generate an average, synthetic PSF from the DynamicPSF tool and use that image directly in the Deconvolution process (as "external PSF"), so you shouldn't have to re-type anything into the Deconvolution processes' PSF generator.
Title: Re: Deconvolution strategies
Post by: Jim_ on 2012 October 01 18:34:29
just uncheck "use signed angles" in the DynamicPSF process and you'll get angles you can use.

then again you can generate an average, synthetic PSF from the DynamicPSF tool and use that image directly in the Deconvolution process (as "external PSF"), so you shouldn't have to re-type anything into the Deconvolution processes' PSF generator.

Thanks pfile.
I'm playing around with both settings.
So far, when I use the synthetic PSF I get a pretty bad rings.
That's half the fun of it though...playing around with it.

Jim
Title: Re: Deconvolution strategies
Post by: pfile on 2012 October 02 08:16:10
here's what i've found - my PSF/FHWM usually differs quite a bit between my G/B channels and my R channel. i don't know if you are using an OSC or DSLR, but if you are, try extracting each channel separately and making a different PSF for each, then do 3 separate deconvolutions, one for each channel. you'll almost certainly need to tweak the deringing settings for each channel individually.
Title: Re: Deconvolution strategies
Post by: darkownt on 2012 October 02 09:46:21
Not sure if this helps but for tweaking synthetic PSFs I have found the following useful.

Massaging a PSF

Once you think you have a synthetic PSF which is the closest to what you need, use the same values and adjust them in the convolution tool.
Click the little square that generates an image of the convolution kernal.  Rename this my_PSF

Create a full image Preview in the my_PSF image.  Set up your deconvolution or restoration to point to the preview image of my_PSF as the PSF.  Select the Preview of the my_PSF and open an adjust curves tool.  Play with the curves to "massage" or mold the PSF.  When you apply it, only the preview changes.

Try the Decon or restoration on your real image (probably a preview so you dont need to undo it). See the results.

As needed select the PSF preview and tweak and apply the Massaged curves on it... and then select your image and try decon again.  Your decon tool will keep pointing at the PSF preview and you can keep massaging it as needed.

Try adjusting low values in the curve to adjust outer areas of the PSF, high values of the curve affect the inner areas of the PSF.

After some practice you should get the hang of how things change when you massage the PSF.

Just an idea.