Tests Of GREYCstoration

GREYCstoration is an open-source application for:
  1. Noise Removal by anisotropic smoothing
    -restore inputimage [-processingoptions] [-o outputimage]

  2. Inpainting to fill in masked areas
    -inpaint inputimage [-processingoptions] -m maskimage [-o outputimage]

  3. Resizing (this appears to be standard resizing followed by several iterations of smoothing)
    -resize inputimage -g widthxheight [-processingoptions] [-o outputimage]
If no output is specified, then the processing window still opens to show progress, to do further iterations, or to save the image to GREYCstoration.bmp

The software can be optained at http://cimg.sourceforge.net/greycstoration/ from the download page.
You can find lots of examples.
You can also find a user's guide for noise removal and a bit about inpainting.
The problem is that there is little information with the examples about what paramters were used and the User's Guide has incorrect information about the default parameters.
My objective in this study was 1) to experiment with each function, 2) to figure out what the default parameter values really are and 3) to learn a little about what the paramters do and which ones are useful. I have little understanding of the theory behind this application. So most of what I have learned has been by trial and error.


The first thing was to look at the source code where I did find information about the actual default parameters (as my initial experiments lead me to believe that the information in the User's Guide was wrong).
For Noise Removal, the actual default values are as follows:
  • amplitude: -dt 40.0 Regularization strength per iteration (>=0)
  • sharpness: -p 0.9 Contour preservation (>=0)
  • anisotropy: -a 0.15 Smoothing anisotropy (0<=a<=1)
  • alpha: -alpha 0.6 Noise scale (>=0)
  • sigma: -sigma 1.1 Geometry regularity (>=0)
  • gauss_prec: -prec 2.0 Computation precision (>0)
  • dl: -dl 0.8 Spatial integration step (0<=dl<=1)
  • da: -da 30.0 Angular integration step (0<=da<=90)
  • interpolation: -interp 0 Interpolation type (0=Nearest-neighbor, 1=Linear, 2=Runge-Kutta)
  • iteration: -i 1 Number of iterations of processing (>=1)
The User's Guide generally does a good job of describing the purpose of the main parameters and how to adjust them. However, some of the default values stated there are incorrect. See above for correct values.
From my experiments, I learned the following:
  1. Smoothing is mostly controlled by -dt and iterations
  2. One iteration of a large value for -dt is often equivalent to many iterations with a smaller -dt
  3. However, with proper choice of other parameters, sometimes more iterations are better as sometimes it prevents too much smoothing across high contrast areas (edges)
  4. A smaller value for -p produces more smoothing. But this parameter is very sensitive. Thus values smaller than 0.7 often produce unacceptable results.
  5. The -a parameter controls how anisotropic (directional) is the smoothing. A value larger than about 0.2 may produce artifacts.
  6. The -alpha parameter is a threshold for the size of the noise to remove. Too small a value will not smooth the noise. Often the default is too small.
  7. The -sigma parameter is not very sensitive. Larger values produce a little more smoothing.
My objective in this study was 1) to experiment with each function, 2) to figure out what the default parameter values really are and 3) to learn a little about what the paramters do and which ones are useful. I have little understanding of the theory behind this application. So most of what I have learned has been by trial and error.


EXAMPLES

Remove Dither Pattern
(Image From GREYCstoration examples page)
Original
Arguments:
-restore inputimage (defaults)
Arguments:
-restore inputimage -alpha 1
Arguments:
-restore inputimage -alpha 2
Arguments:
-restore inputimage -alpha 1 -p 0.7
Arguments:
-restore inputimage -alpha 1 -dt 100
Arguments:
-restore inputimage -alpha 1 -iter 3


Remove Dither Pattern
(Image From http://www.mediacy.com/index.aspx?page=AH_FFTExample)
Original Arguments:
-restore inputimage (defaults)
Arguments:
-restore inputimage alpha 1
Arguments:
-restore inputimage alpha 1 -dt 100
Arguments:
-restore inputimage alpha 1 -dt 100 -iter 4


Remove JPEG Block Artifacts
(Image From GREYCstoration examples page)
Original Arguments:
-restore inputimage -alpha 1 -iter 2


Remove Speckle Noise Pattern
(Image From GREYCstoration examples page)
Original
Arguments:
-restore inputimage -alpha 1
Arguments:
-restore inputimage -alpha 3
Arguments:
-restore inputimage -alpha 3 -p 0.7 -a 0.2


Remove CCD Sensor Noise
(Image From http://www.gimpguru.org/Tutorials/ReducingCCDNoise/)
Original Arguments:
-restore inputimage -dt 100


Remove Heavy Noise
(Image From GREYCstoration examples page)
Original Arguments:
-restore inputimage -dt 100 -iter 10
Arguments:
-restore inputimage -alpha 1 -iter 10
Arguments:
-restore inputimage -p 0.75 -iter 10
Arguments:
-restore inputimage -p 0.75 -sigma 0.5 -iter 10
Arguments:
-restore inputimage -p 0.75 -sigma 0.5 -a 0.2 -iter 10


Remove Linear Striation Noise
(Image From http://www.roborealm.com/help/FFT.php)
Original Arguments:
-restore inputimage -p 0.7 -a 0.2 -alpha 1 -iter 2


Inpainting
(Image From GREYCstoration examples page)
(other parameters not tested)
Original Mask (IM Processed Original)
-threshold 99%
Arguments:
-inpaint inputimage -m maskimage


Resizing
(Image From GREYCstoration examples page)
Parameters:
  • -g widthxheight
  • -anchor Anchor original pixels (keep their original values) ---
    -anchor true (without GREYCstoration) or false (with GREYCstoration); default=true
  • -init Initial estimate (1=block, 3=linear, 4=Moving average, 5=bicubic); default=3
  • -interp Interpolation type (0=Nearest-neighbor, 1=Linear, 2=Runge-Kutta); default=0
  • Other parameters not tested.
Original
221x209
ImageMagick Resize (200%)
-resize 442x418!
Arguments:
-resize inputimage -g 442x418
bilinear; no GREYCstoration
Arguments:
-resize inputimage -g 442x418 -anchor false
bilinear; 4 iterations GREYCstoration
Arguments:
-resize inputimage -g 442x418 -anchor false -init 5 -interp 1 -iter 2
bicubic; 2 iterations GREYCstoration
Arguments:
-resize inputimage -g 442x418 -anchor false -init 5 -interp 1 -iter 1
bicubic; 1 iteration GREYCstoration