Denoising with GREYCstoration

A couple of comments in my previous entry about noise mentioned GREYCstoration, an opensource software that aims to bring the same quality of denoising than NoiseNinja. It is available either as a Gimp plugin or as a command line utility.

So let’s take a look at this program and see what we can get out of our example image.

GREYCstoration has quite a few options to tweak around as can be seen on their user’s manual.

The Gimp plugin

Using GREYCstoration as a Gimp plugin allows to check what the parameters do (in the preview) and find the optimal ones. Here is what the plug-in window looks like:

greycstoration_plugin.jpg

In my cases, I didn’t need to tweak a lot, I just changed the Noise scale to 5.0 and choosed to use the Runge Kutta algorithm (I decided it looked a tad better with it). The output quality is good, although the undifferentiated action on chroma and luminance noise gives this water-colored washed out output, which I don’t like very much:

noise_grey_o.jpg

Command line for 16bits

From there, I decided to take my parameters into the command line version, which supports 16bits treatment. The equivalence between the plug-in and the command line version are straightforward:

strength :: -dt

contour preservation :: -p

anisotropy :: -a

noise scale :: -alpha

geometry regularity :: – sigma

spacial step :: -dl

angular step :: -da

approximation :: -fast

iterations :: -iter

interpolation algorithm :: -interp

so my command was:

greycstoration -restore ufraw_0.tif -bits 16 -o test.tif -dt 60 -p 0.7 -a 0.3 -alpha 5 -sigma 2.3 -dl 0.8 -da 30 -fast true -iter 1 -interp 2 -sdt 0

the -sdt 0 bit was to ask GREYCstoration not to do any sharpening on my image.

The processing to approximately for ever and a day to complete. GREYCstoration opens a windows with your image in it and when the processing is done, click on the window and press “S” for save. Check that the result image (test.tif in this case) is saved and then “Q” will quit. The result is the same image than in The Gimp but in 16bits precision.

What about luminance noise?

Call me crazy (if not already done) but I much rather like some luminance noise left than a water-colored image. In talking to the maintainer about my taste for luminance noise, he added an option to differentiate treatment on chroma vs luma noise. You can do that by using the -cbase 1 (0=RGB, 1=YCrCb) -crange 1,2 (0 is luma noise which we want to preserve). By the way, this options  is currently only working in the command line version. The result is good, although it is possible to do better:

noise_grey_y.jpg

To get the “better option”, I opened the original image in The Gimp, desaturated it (using Luminance) and picked “color to alpha” to have the white parts of the image transparent. I saved that as PNG – I have to do this part in The Gimp since I haven’t found the “color to alpha” or equivalent in Cinepaint.

I opened the two files (PNG and denoised one) in Cinepaint and added the PNG as a new layer on top of the denoised file – with a transparency value of 0.60. I flattened the image.Because the noise channel makes the whole image a bit darker, I tweaked the curve to give more light in the darkest parts of the image since they are the most affected by the luminance noise that was re-added.

I am really happy with the final result:

noise_grey_mine.jpg

Compared to NoiseNinja:

noise6_nn.jpg

Final Word

It is good to see that OSS delivers a very good result, comparable to what commercial software offers. However (and as often) it is lacking a bit of polish as it takes quite some time and more operations to get that result. I am however talking with David Tschumperlé (the author of GREYCstoration) to see if there is a way to automate “my” denoising steps.

Noise is rarely a problem for my images so I can very happily live with GREYCstoration if I need denoising. Because of its command line nature, it can be integrated easily in a batch processing of several images with the same noise characteristics.

By the way, David Tschumperlé is looking for a maintainer for The Gimp GREYCstoration plugin, so if you have the right skills and motivation, get in touch with him.

21 Responses to “Denoising with GREYCstoration”

  1. Rolf Says:

    Again a great article!

    I have been tinkering with this plugin for my podcast ( http://meetthegimp.org ) and ran into this same plastic effect. I was thinking about using the plugin only on the A and|or B channel of a LAB decompose and then recompose the image. So only the colour noise would be affected.

    But I haven’t tried it yet, too much stuff in the pipeline. Among other stuff an interview with a blogger from Geneva. ;-)

  2. Rolf Says:

    It may work:

    In the circles is your original, outside a version where I simply blurred the A & B channel with Gaussian Blur, radius 10. Less chroma noise.

  3. Rolf Says:

    Sorry, the link to the image was eaten by wordpress.

    http://img90.imageshack.us/my.php?image=noise3uc2.jpg

  4. Xavier Says:

    Great post Joel!

    I ll have a closer look at this plugin since noise is often an issue for me in low light hi speed sports shooting.

  5. jcornuz Says:

    Hi Rolf,

    It’s been a long time :)

    If I understand correctly, you decomposed the image in LAB and applied GREYCstoration to the A+B, leaving Luminance untouched. I tried that and the output is very close to what I got leaving the Y and denoising CbCr (command-line only). I still prefer my “soupe” since the grain / noise is finer and you can control how much of it you want in your final image (by playing with transparency). I am waiting for an answer from David to see if there is a possibility to automate the process.

    Xavier,

    A pleasure to read from you. Happy new year and sorry for beeing rubbish a keeping in touch. If you have lots of pictures to denoise, it may be worth investing in NoiseNinja (available on Linux) or Bibble (if you need RAW dematricing as well).

    Take care,

    Joël

  6. Rolf Says:

    I did that try on my notebook without GREYCstoration installed. That was simply a Gaussian Blur of 10 in A and B. Very fast! ;-)

  7. Monsieur Z Says:

    You can also decompose the picture in YCrCb, then use Greystoration plugin on Cr and Cb channels (leaving Y channel untouched) and finally recompose the picture from the three resulting layers.

    I’m not sure if the plugin uses 16/32bits math internally before producing the 8 bits output, but the result looks OK to me.

    I believe the decomposition/recomposition could be automatically performed in the plugin via a “keep luminance noise” checkbox or something.

  8. jcornuz Says:

    Bonjour Monsieur Z!

    The last version of GREYCstoration can have a different action on Y vs Cr and Cb channel (command line only) but the luminance noise is not as fine as adding a desaturated layer on top of the denoised one (see above).

    Take care,

    Joel

  9. Jarno Suni Says:

    Is there a way to automate the whole denoising process for file(s)?

  10. jcornuz Says:

    Hi Jarno,

    GREYCstoration is foremost a commandline tool. So you can integrate it in a bash script. see: http://jcornuz.wordpress.com/2007/10/26/imagemagick-and-bash-batch-power/

    Take care,

    Joel

  11. Jarno Suni Says:

    I know, but your method includes actions taken in Gimp and Cinepaint. I couldn’t do what you did in Cinepaint. Can you give more specific instructions? Is there way to do the actions you did by Gimp and Cinepaint as part of such a bash script?

    Some remarks: Applying the final greycstoration command for a 10MP (jpeg) image by 1.5GHz CPU took about 40 minutes. Storing as PNG is slow when compared to storing as LZW compressed Tiff in Gimp.

  12. Jarno Suni Says:

    Additionally the visualization window of command line GREYCstoration did not display anything useful (a blank screen) so I used “-visu false” option.

  13. jcornuz Says:

    Hi Jarno,

    What I did was to chose the best settings in Gimp via the plug-in and then use these settings via the command line to produce a 16bits output which I then touched up in Cinepaint.

    Take care,

    Joel

  14. Jarno Suni Says:

    You told above in the blog that you did few things including “color to alpha” to the original in Gimp after running GREYCstoration in command line and combined the two images in Cinepaint. I just couldn’t follow your instructions on what you did in Cinepaint. How do you add the PNG as a new layer on top of the denoised file – with a transparency value of 0.60?

    Anyway I think the GREYCstoration algorithm takes too much time. I guess you can get about the same effect by Raw Therapee’s Color Noise Reduction in fraction of the time. Sad that Raw Therapee is generally slower than Rawstudio, but Rawstudio does not have noise reduction.

  15. Jarno Suni Says:

    In manual of Raw Therapee it is said that the color noise reduction is ‘the traditional Gaussian filter on the CIELAB “a” and “b” channels’ (when Edge Sensitive is not checked in the user interface).

  16. jcornuz Says:

    Hi Jarno,

    I could have explained better. To “add the PNG as a new layer” in Cinepaint, open your denoised image file, create a new empty transparent layer. Open the PNG file in Cinepaing, copy it and paste it in this new layer.

    At the end of the day, if you are happy with RawTherapee, that’s all that counts.

    Take care,

    Joel

  17. Bert Says:

    Copying to alpha and compositing can be done from the commandline with Imagemagick.

    Copying the image to its own alpha channel:
    convert in.png +clone -compose CopyOpacity -composite out.png

    Compositing 1.png over 2.png with 60% transparency:
    composite 1.png -dissolve 60 2.png out.png

  18. Ji Says:

    thanks for this article.

    You mentioned the possibility of using GREYCstoration in a batch script by using the commandline version. However, GREYCstoration requires I manually save and quit before my script can work on the next image. The ability to swap images to compare is very useful when I am working on one file, but I want to skip this when running on a whole directory of images. Do you know if there is a way to do this? thanks.

  19. Claes Says:

    This blog article inspired me to do the noise reduction lab I have documented at http://www.flickr.com/photos/14483885@N00/sets/72157610663975317/.

    Ji: -visu 0 suppresses the window / save process.

  20. waleed EGY Says:

    about saving image automatically from this tool,it is found after a really long search.
    from the command prompt add the parameter (-o) followed by output image path.
    I knew it by accident ,thanks to tool “greycstoregui” from sourceforge.net at http://sourceforge.net/projects/greycstoregui/

    I hope this could help,I out here this answer to help anyone to use this unwell documented option.

    thanks
    waleed
    egypt

  21. waleed EGY Says:

    by the way ,thanks jaruni sunny ,for the option “-visu false”

Leave a Reply