TGVDenoise Example: Noise Reduction in CIE Lab Mode

Juan Conejero

PixInsight Staff
Staff member
Hi all,

As promised, here is a first noise reduction example with the new TGVDenoise tool. To show a complete workflow with color data, I have chosen an image that poses a relatively difficult problem for noise reduction. It is a Canon EOS 7D raw image that has already been stretched and saturated with the HistogramTransformation and CurvesTransformation tools in PixInsight.

A strong color saturation curve has been applied directly after the initial stretch, which has been an obvious mistake: A side effect of this uncontrolled color saturation boost is generation of severe noise in the chrominance. We know that color saturation enhancements must be applied with some control (with protection masks, and/or after noise reduction, etc.), in order to prevent chrominance noise intensification. But this is just an example, where I have taken the liberty to make some things difficult on purpose.


The resulting image is an interesting noise reduction problem, mainly due to the following factors:

(1) Severe chrominance noise, for the reasons explained above.

(2) Fine details at scales dominated by the noise.

(3) Low-contrast structures that can be problematic for edge protection.

(4) Extended background areas with strong noise and no significant detail.

Reason (1) is why we have implemented a special CIE Lab working mode in the TGVDenoise tool. When the noise is very different (in its distribution and intensity) for the lightness and chroma components, applying two separate noise reductions seems the most logical option. Reasons (2) and (3), and the fact that they are plainly opposite to (4), suggest the need for a local support image to drive the TGV regularization algorithm.

As usual, we'll work on a small preview covering a region of special interest. Recall that as long as we don't enable its automatic convergence parameter, TGVDenoise is a fully previewable process, so what we'll get on the preview will be consistent with the result obtained on the whole image.


The screenshot above will give you an idea of the severity of the noise in our working image, especially color noise.

Our first step is building a local support image. By default, the TGVDenoise tool uses the intensity component (in the HSI system) of the target image. In this case, however, I prefer to work with the lightness component because it is much less noisy than intensity, due to the color noise problems that I have described. So we'll extract lightness (IMAGE > Extract > Lightness) as a new image and select it as a local support on the TGVDenoise tool.


Recall that a local support is intended to represent the signal-to-noise ratio of the target image, with the purpose of conditioning the TGV noise reduction algorithm. So where the local support image is white we are saying 'this is signal, look but don't touch!', and where the support is black we say 'this is trash, remove it please'. To improve the support in this sense, we have several histogram controls. I have used the midtones balance and shadows clipping parameters to increase contrast, as shown in the next screenshot:


I have also removed the first wavelet layer to make the support slightly less noisy, and hence more accurate. Note that this does not alter the support image in any way; the transformations are applied to an internal working duplicate, never to the selected image.

On the screenshot above, note that I have selected the Preview mode in the Local Support section. In this mode, TGVDenoise replaces the target image with a copy of its internal working support image, which is useful to control the support. We have to disable this mode to perform an actual noise reduction procedure.

As I have said at the beginning of this post, we'll work in the CIE Lab color mode of TGVDenoise in this example. We'll start with lightness noise reduction, so we'll disable chrominance parameters and select the Lightness display mode for the target image. In this way we can concentrate on the lightness, without wasting time processing the chrominance components. This allows us to save a 67% of processing time during our initial testing steps.


After some trial-error work, this is my processed lightness:


Let's repeat the same procedure for the chrominance. Disable lightness parameters and select the "a=R b=G" display mode:


In this mode, the red and green channels show a representation of the CIE a* and CIE b* chrominance components, respectively. This allows you to visualize the color components of the image independently from lightness, that is, what you see on the screen is a special rendition of pure color contents. This mode is especially handy for noise reduction, as you can see in these screenshots. Below is my final processed chrominance.


Note that the chrominance parameters are much more aggressive than the lightness parameters. As you know, the human vision system is rather poor at detecting details defined by color variations. Most of the detail we perceive in an image comes from lightness variations. Thanks to this property of our vision, we usually can apply a comparatively strong noise reduction to the chrominance without damaging the perceived detail. In this example, I have used an edge protection parameter value that is about one order of magnitude larger for chrominance than for lightness.

This is my final denoised image:


For better evaluation of the result, let's take a closer look at some regions of particular interest. Below are three crops of 200x200 pixels enlarged 3:1 without interpolation; original versus processed image.

crop01_original.png
crop01_final.png

crop02_original.png
crop02_final.png

crop03_original.png
crop03_final.png

The result is very good in my opinion, especially considering the severity of the noise in the original image. It is not perfect, of course, and we can easily find positive and negative aspects. For example, some low-contrast structures have been damaged in the green stem of the third crop, and we can find a number of small details that have lost some of their initial color support. On the other hand, low-contrast features have been preserved remarkably well on the shadowed yellow areas of the second crop, and the spider webs have been protected extremely well over a smooth background on the first crop. Overall, this kind of result is very difficult to achieve, if not impossible, with other noise reduction tools that we have implemented in PixInsight. More examples to come.
 
Impressive! Will you include this in the built-in documentation? It would be nice to have this available off-line without having to search for it.
 
Hi Sander,

Thanks! Yes, we'll gather all the material we are posting here to write an official documentation for TGVDenoise.
 
Hi Juan,

really impressive; this is just what I was looking for for a long time. You have managed to create an absolute professional wonder weapon; placing all of the other Plugins like noise ninja for example in the darkness; forget about them  O0
A big thank you to the whole PI team for this stunning part!

Just a stupid question; the tool wasn't especially created for DSLR data; it will work by the same manner on mono or OSC CCD data?

Best and keep on stunning me (us)  >:D

Lex
 
Hello Juan
Very impresive.

About the example, in order to get the final result,  did you first apply tgv on ligness and afterwards on crominance or did you apply it all together at the final step?

I did a little test on the tool last night, and got some ringing on stars (dark halos) (had not more time to continue experimenting) does this ringing have to be minimized trough edge protection parameter? or by adecuating local support image?

Regards
Geert
 
Hi Lex,

Thank you!

it will work by the same manner on mono or OSC CCD data?

TGVDenoise works with any kind of images, including linear and nonlinear (stretched) images, color and grayscale images.
 
Thank you Geert,

in order to get the final result,  did you first apply tgv on ligness and afterwards on crominance or did you apply it all together at the final step?

In the final step I have enabled both lightness and chrominance parameters. You could also apply first to lightness only, then to chrominance only. This can be useful, for example, to use a different support image at each stage.

I did a little test on the tool last night, and got some ringing on stars

That should never happen under normal conditions. If you upload the image in question, I'd be glad to try out TGVDenoise on it. Keep in mind that we are still learning to use this tool!
 
i saw ringing like that when trying to work on a linear image (m63). for fun i stretched it and it seemed to be a lot easier to hone in on the right parameters.
 
The ringing may be generated by an insufficient number of iterations. First try a huge number of iterations on small previews (lets say, 500). Then, use the convergence criteria on larger images to stop when no visible change is achieved.

 
Hi

I tried some testing on b/w linear astronomy images and it is hard to find the good parameters (even the local support). Need many try
In this case, many parameter are very low in the range 10-5 / 10-6. A few variation on parameters can change the result in bad or good !
But, at the end, the result can be very good  ;)

It is the most powerful noise reduction function BUT need practice and many tries. Also to be careful to not remove all the noise (it is not nice) 
For sure, examples like you provided, Juan, is very useful to understand. Now I learn and see the "local support" importance !
 
Hi Philippe,

Thanks. Yes, this tool requires a lot of practice. Well, actually not more than any complex tool. Once you get some practice you start 'feeling' the parameters and it becomes easier each time you process a new image.

What we need now is more data to test the tool. If you can upload an image, I'll be glad to make an example and post it here.
 
I tried this out last night on a very noisy image-in-progress and saw significant improvement with the just the default parameters.  This looks to be a very powerful tool and I'm looking forward to working with it some more.

Thanks for all the work!

Will
 
Nice module. The default parameters work well for stretched images. Linear images (based on a sample of 1) seem to need more tweaking.
Geoff
 
Juan Conejero said:
What we need now is more data to test the tool. If you can upload an image, I'll be glad to make an example and post it here.

Thanks Juan, I will prepare you some linear monochrome images  8)
 
Hello Juan

Here you can download the image I used for testing:
http://rapidshare.com/files/1028361636/m83.fit

It is a linear image just after crop and DBE.

I also tested the tool after non linear stretch and it performed better.

Regards
Geert
 
I am starting to have some success with linear images.  The key is to work on the edge protection parameter first, and to use much smaller values than the default.  For example I am using 1e-5 for Chrominance and 9e-6 for Lightness.

I found the right values by creating a local support image first:

- Extract the Lightness and then use the histogram transformation process (with preview) to find the appropriate Highlight, Midtones and Shadow values.
- Cut and paste these in to the Local Support settings (quicker than repeatedly executing and undoing previews in the TGV tool to get the right stretch)
- Preview the noise reduction setting until you find a value that kills off any background noise in the protection image.

Next work on Lightness only (disable preview, disable chrominance):

- Apply an STF to the target image (tricky to find a good stretch for lightness only display when the image is linear but managed it in the end).
- Work on a small preview of the main image first, set iterations to 500 or 1000 and don't use convergence to start with.
- Start with default values and run TGV.
- You will get terrible ringing artefacts on a linear image so reduce the edge protection exponent by -1.
- Undo the TGV on the preview and reapply with the new exponent.
- Repeat the process of reducing the exponent, undoing and re-applying until you find a value for edge protection where you get no smoothing effect at all.
- Now perform a binary search between the lowest value where you got ringing and the value where there was no smoothing.  You should just need to work on the coefficient (or maybe go back up one exponent and then change the coefficient). 
- Start with a coefficient halfway between the lowest value you where you still got ringing and the no ringing values.
- If there is still ringing try the value halfway between the current one and the lowest value, conversely if there is no ringing go up halfway to the higher value.
- Repeat the binary search until you home in on the value where ringing just stops, which should give you maximum smoothing.

The range between ringing and no ringing is tiny in my linear images, the difference between 0.00000900 and 0.00000800 for example.

Then turn off lightness  process and follow the same process for chrominance.  It will be in a different range but probably very small again.  Once you have nailed the edge protection you can play with strength and smoothness to see what looks best.

Just be aware that once you switch to the full image using convergence you will get ringing again.  You just need to tweak the edge protection for lightness and then chrominance in the same way as before.  It takes longer on a full image but you should be a lot nearer to start with now.

In the sample below all the normal images are linear, starting with the stack which has had Canon Banding script, 2 x DBE iterations and initial ColourCalibration.  Next right is the result of TGV using values as shown in the dialog (plus slightly more agressive values for chrominance).  Next right is the extracted Lightness to the right as support and a clone of it showing the stretch applied by TGV.

Bottom left is an Atrous denoise on layers 3, 4 and 5 with a luminance mask as shown to the right of it.  The final result is a lot smoother than any other method I have tried on my noisy DSLR images and could be improved with a bit more tweaking on the Atrous settings I think.  Blinking between the denoised and original images, the features seem like they have been layered on top perfectly with no damage to the interesting stuff but good smoothing of the background, whereas most of the other techniques you can see a clear erosion of signal as well as noise to the outer regions of galaxies, etc.

Ready for the next steps in processing.

I achieved this in about 2.5 hours from a cold start after from reading the tutorial today, so this is an excellent new tool I'd say!
 

Attachments

  • TGV.jpg
    TGV.jpg
    424.3 KB · Views: 209
Hi,

I have uploaded an image to endor for others to try their hand with the new TGVDenoise module.  Here is the link:

http://endor.uv.es/files/data/public/f31a3b212a820800c6ec7361030d4c2b.php?lang=en

Particulars about this image.  It was taken with an AP155 f/7 and an ST10XME at -5C.  This linear tricolor image of M101 was generated with 24 5 minute exposures through each of the RGB filters for a total exposure of 6 hours. Each of the sub exposures were calibrated with master bias and master flats generated from 50 subexposures.  The master flats were generated from 21 subexposures for each color.  All calibration, registration, and integration was done with Pixinsight 1.87.

The image is noisy. I have attempted using the new TGVDenoise module with this image in both linear and non-linear states.  As others have pointed it out, it is much easier to find TGVDenoise parameters when image is non-linear.  My best efforts with TGVDenoise still leave me with a "blotchy" background that I am unable to clip to my satisfaction.

It would be interesting to see what others can do with this image.

Cheers,

Don
 
Hi Juan

I sent you by email the link for these 6 linear images taken with my setup. THis is preprocessed integration.
I think they are typicaly what we obtain on deep sky nebulas objects with a CCD camera.

PITGV.JPG


Most of them have very low light signal and moderate noise. Some have higher signal and noise.
The goal is to REDUCE (not REMOVE) the noise AND preserve maximum of the details.


TGVdenoise is a powerfull process but, as always, the job must be done during the acquisition (exposure time, number of exposure, tracking, preprocessing quality). I will not process a very noisy image.


thanks
Philippe
 
Back
Top