Author Topic: Chicken and Egg or Noise Reduction and Sharpening - which comes first?  (Read 4786 times)

Offline Buzz

  • PixInsight Enthusiast
  • **
  • Posts: 80
    • The Astrophotography Manual - support
I know we must experiment, experiment, experiment - but these processes have mathematical basis and so I'm assuming there has been some analysis that suggests which comes first for maximum improvement.

Is there a general preferred order for sharpening and noise reduction in linear / non-linear stages. A forum search surprisingly suggests this is the first time the question has been directly asked.

regards
Chris
« Last Edit: 2016 July 04 05:08:07 by Buzz »
regards
Chris

Offline Rob Friefeld

  • Newcomer
  • Posts: 34
I like the question, and I'm looking forward to someone's authoritative answer. One wonders: is sharpened noise easier to reduce later? Does unreduced noise become unmanageable after sharpening? How much does the order depend on the specific qualities of the data? My own (intermediate level) experimentation has indicated that I do a linear stage noise reduction, sharpening in the non-linear stage, then usually mild TGV noise reduction near the end of the processing. I am struggling with learning to use deconvolution without introducing artifacts. I've been sharpening with MLT.

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Chris

I have started using the MureDenoise script recently in the way that Mike describes using it. After calibration but before any other processing. I have found for my images this becomes the only time I use noise reduction in the entire workflow. I try to be very careful during my processing not to generate noise also. I find Mike's script to be amazing. Oh yeah I'm using a DSLR. Once I got the gain, noise and offset figures for my camera MureDenoise worked perfectly. So I split the channels, use Muredenoise and then recombine the channels and continue. That simple.

Here is a link explaining MureDenoise. http://pixinsight.com/forum/index.php?topic=9206.0

As far as sharpening my thoughts are sharpening is needed for three of reason. One your focus is off very very slightly. Two seeing conditions are not perfect. Three I want to emphasize something in an image. For the first two cases the only tool to use IMO is Deconvolution. When used properly it can help those conditions. It can't fix them though but it comes close. For the third case use what ever works for you. In all cases they can be done while linear. The third of course could happen while non-linear also. In all cases you just need to be careful not to generate false artifacts. I try to be careful but....  Working with a tool and then having to use some noise reduction afterwards because 'I' generated noise is counter productive. I should not have generated the noise in the the first place.

I try to do all processing while linear so my last step is the stretch to a non-linear image, but that just me. I find I it much easier for my images to not generate noise during the processing while linear but I no scientific data to back the up. Pixinsight has so much control available to the user that working while linear is easy. Even things like star masks can be created while linear, the controls are there in the tools.



Mike

Offline Buzz

  • PixInsight Enthusiast
  • **
  • Posts: 80
    • The Astrophotography Manual - support
Mike - I agree with you on the deconvolution front.  I should have framed the question a little more specifically.

I am generally interested in the noise / sharpening after deconvolution - typically using multiscale tools and TGV Denoise. When I introduce multiscale into the variables I know that some might to side-skip the question by saying that you apply noise reduction and sharpening to different scales. I think the reality is not so convenient. I have seen some posts that say one should not use noise reduction and bias (sharpening) in MLT and MMT at the same time- which suggest you use them separately... and hence the original question, what order?

I am typically using CCD images - but I will check the script for hints too. 
regards
Chris

Offline javajunkie2121

  • Newcomer
  • Posts: 42
I'm also curious about the order of deconvolution and linear noise reduction for LRGB CCD images...I've seen a couple older references that mention linear noise reduction first, while others have deconvolution first?

jeff

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Buzz,

Just FYI: For my blog Ha images, I've combined denoising and sharpening into a single process run on the linear data. In the wavelet domain, detail coefficients get classified into three groups, small, medium, and large. Coefficients smaller than the local noise level get "shrunk" (this is exactly what MureDenoise does), medium coefficients get "stretched" (i.e. sharpen blurry edges larger the noise level), and large coefficients remain invariant (don't mess with existing sharp edges and stars). Basically, I don't want to sharpen noise nor damage things that are already sharp.

The API is basically MureDenoise plus extra parameters that specify the size of the medium zone, the amount to stretch, and the amount to taper the stretch at higher wavelet levels. I have no automatic way to determine these parameters, I just adjust them until I like what I see.

This all works OK on my data, but it is too early to say if it works more generally.

I don't use deconvolution, never have gotten good results, possibly due to the undersampling.

Thanks,
Mike

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 931
  • Two questions, Mitch . .
    • Jim Morse Astronomy
Jeff (& Buzz),

For what its worth and having tried both at different times, IMHO its makes the most sense to do the noise reduction first.  I am a firm believer in not overdoing noise reduction in the linear phase (getting it wrong really causes a mess when you stretch overly or poorly corrected data).  In my mind I see deconvolution as operating in a similar vein to stretching.  I want to deconvolve the cleanest data I can which means careful noise reduction first, especially if you can get clean results without destroying detail (Mure when operating at its best and MLT to a lesser extent).  What I don't want to do is sharpen noisy data that will just make later clean up that much harder.

As far as ordering is concerned, I am as hands off as reasonably practicable in the linear stage doing little more post calibration/integration/DBE than cleaning each channel with Mure or MLT, then using Decon on my Synlum (I only shoot 1x1 RGBs, no lums).  Everything else waits until after stretching.  I often even put off channel combination until after I stretch because I often get my best results using SHO-AIP for my combinations, especially in NB but often also with RGBs as well. 

Bottom line, there are just too many hidden missteps you can make in over doing linear processes that only become evident once the image is stretched.   

For what it's worth.   

Jim

p.s.  As for using Deconvolution, I was lost until saved by two sources, Mike Wile's superb video: http://mike-wiles.blogspot.com/2013/08/pixinsight-deconvolution.html
and this tutorial: http://www.pixinsight.com/examples/M81M82/index.html

(Note I do share Mike's view that it work's best with well sampled data and only find that I get worthwhile improvements when using with my system that is 0.73 arcsec per pixel (CDK12.5-SBIG6303) versus the one at 2.56 arcsec/pixel (Tak e130D-SBIG8300)).

I combined those two into the following workflow:

Apply to Linear Images only!
Use on Lum or Lum equivalent (SynLum or HA in NB images)

Create Masks:

Local Support Deringing Mask:

As a first step try deconvolution without local deranging support.  For many images, global deranging alone may be sufficient.  If you need local deranging support, then build the deranging mask as follows:

Mask bright stars, but not just “super bright”
Look for strong red on bright stars, no protection on target

Pre-process image before applying StarMask
Duplicate image
Use MLT to remove 1st and residual wavelet layers in a 5 layer decomposition
Use StarMask on resulting image per below

Use Star Mask tool
Starting settings:
Noise threshold: 0.01
Scale: 3
Structure growth: 1-4-2
Smoothness: 16
Check “aggregate” and “binarize”
Do not check “invert”
If any of the target area remains (such as bright portions of galaxies), use CloneStamp tool to remove while leaving highlighted stars untouched
Smooth mask by applying a Gaussian Convolution
Start at settings of StdDev 5, Shape 2, and Aspect Ratio 1
Once satisfied, rename “Deringing mask”
Minimize for later use

It is VERY important to build a suitable local support for deringing: Try using a StarMask that covers well the brightest stars with 10-15 pixel of smoothness and truncation at about 0.75. Then fine trim deringing with a very small (usually less than 0.02) amount of global deringing.

Luminance Mask:

Should only exclude background – covers target and stars
Provides smooth transition b/t high and low SNR zones

Make clone of image
Do an auto STF stretch on clone
Copy STF settings to HT tool (pull STF bottom left triangle to bottom bar of HT)
Apply HT to clone to make permanent stretch
Move Shadows just to left of first light
Rename “luminance mask”
Minimize for later use

Create Composite PSF:

Open DynamicPSF tool
Select ~60-70 stars of medium brightness (unsaturated)
Moffat only
Type “Control – a” to select all
Sort list by increasing order of MAD (median absolute deviation)
Highlight best ~50 stars
Hit the little camera button on bottom of tool to create a composite PSF image
Minimize for later use

Deconvolution Process Steps:

Open Deconvolution Tool
Insert PSF image using “External PSF” tab
Select Dark, Light and Stars Previews to test
Protect original image using Luminance Mask (background Red)
Activate “Local Deringing” and use Star Mask image
Start with Global Dark Deringing at 0.02
[A setting of 0.02 may not do much and if not, try lowering.  I have gone as low as 0.002 and stepped up from there.  Again, this is one tool that rewards lots of experiment with the Global Dark Deringing setting]
Apply Regularized Lucy-Richardson
Start with 25 interations
Open Previews of one or more target areas and of background
Run iterations to test for sharpening and ringing
•   Up iterations to improve sharpening but try not to go beyond 50
•   If ringing in stars, increase Global Dark Deringing (in ~0.02 increments)
•   If no improvement consider an order of magnitude reduction in the Global Dark Deringing setting to the 0.002 and above range

« Last Edit: 2016 July 18 14:03:52 by jkmorse »
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
Apogee Aspen 16803
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMorse

Offline Buzz

  • PixInsight Enthusiast
  • **
  • Posts: 80
    • The Astrophotography Manual - support
Thanks Jim - you are certainly right about taking it easy at the linear stage - it is crucial to use STF to predict the likely end effect of these minute changes.

I have worked out a linear workflow for deconvolution which is proving very reliable and requires few iterations to get to the optimum setting. In effect, I progressively enable and optimize each setting in turn and realised that you can judge the right level by looking at different types of stars or features at each step. For the initial setting, it is a small star on a dark background and then for deringing, a slightly brighter star on a dark background and finally for the smoothing, a bright star over a nebula or galaxy. By doing it this way, I found I did not need to revisit the earlier settings.

I'm pretty satisfied with deconvolution now, which is why I had turned my attention to sharpening/noise reduction.

regards
Chris
« Last Edit: 2016 July 20 06:03:35 by Buzz »
regards
Chris

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 931
  • Two questions, Mitch . .
    • Jim Morse Astronomy
Buzz,

I have test your Decon method.  Very interesting!

Best,

Jim
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
Apogee Aspen 16803
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMorse

Offline Buzz

  • PixInsight Enthusiast
  • **
  • Posts: 80
    • The Astrophotography Manual - support
Jim - you helped me enormously in the past with your sheets - If you PM me your email and I will send you a full description of the method.
This is an example of it at work:  http://www.digitalastrophotography.co.uk/Astrophotography/Images.html#22

It is still work in progress; l have to tame the bright star bloaters.
regards
Chris

Offline jkmorse

  • PixInsight Padawan
  • ****
  • Posts: 931
  • Two questions, Mitch . .
    • Jim Morse Astronomy
Buzz,

Just send it along to jkmorse57@gmail.com. 

Best,

Jim
Really, are clear skies, low wind and no moon that much to ask for? 

New Mexico Skies Observatory
Apogee Aspen 16803
Planewave CDK17 - Paramount MEII
Planewave IFR90 - Astrodon LRGB & NB filters
SkyX - MaximDL - ACP

http://www.jimmorse-astronomy.com
http://www.astrobin.com/users/JimMorse

Offline jerryyyyy

  • PixInsight Old Hand
  • ****
  • Posts: 425
    • Astrobin Images
Hi, all very interesting discussion.  My take as an intermediate user of PI is that you have to be careful removing noise to make sure you do not lose subtle structure too early.  The structures will come out of componets that could be initially seen as noise, thus clobbered. 

That being said, I have been converted to Mure Denoise and use it carefully and have default settings for my CCD at home at the equipment at DSW.  Also I think there is no substitute for enough subs to stack.  My target for NB seems to be at least 16 now.  Little to be gained with my equipment going to 32...

Anyway, after Mure, I deconvolute and this will sharpen the stars.  No question.  Someone at some point was saying they thought they could combine Mure with deconvolution into one procedures... love to see that. 

Later on in stretched images I finish of with TGV with local support of a slightly clipped L image.  I think you have to be careful with TGV to not introduce its own artifacts.... use preview.   
Takahashi 180ED
Astrophysics Mach1
SBIG STT-8300M and Nikon D800
PixInsight Maxim DL 6 CCDComander TheSkyX FocusMax

Offline Buzz

  • PixInsight Enthusiast
  • **
  • Posts: 80
    • The Astrophotography Manual - support
Buzz,

Just FYI: For my blog Ha images, I've combined denoising and sharpening into a single process run on the linear data. In the wavelet domain, detail coefficients get classified into three groups, small, medium, and large. Coefficients smaller than the local noise level get "shrunk" (this is exactly what MureDenoise does), medium coefficients get "stretched" (i.e. sharpen blurry edges larger the noise level), and large coefficients remain invariant (don't mess with existing sharp edges and stars). Basically, I don't want to sharpen noise nor damage things that are already sharp.

The API is basically MureDenoise plus extra parameters that specify the size of the medium zone, the amount to stretch, and the amount to taper the stretch at higher wavelet levels. I have no automatic way to determine these parameters, I just adjust them until I like what I see.

This all works OK on my data, but it is too early to say if it works more generally.

I don't use deconvolution, never have gotten good results, possibly due to the undersampling.

Thanks,
Mike

Mike - I have just used your MURE script for the first time - pure magic. Many thanks.
I have missed it up to now as it was in the scripts rather than the process menu. It does beg the question why scripts and processes are more logically grouped together in functional terms rather than their programming origins?
regards
Chris