Fred's ImageMagick Scripts
|
Reduces noise in an image. |
last modified: November 27, 2011
|
USAGE: denoise [-m method] [-f filter] [-s subsection] [-n nstd] [-u unsharp] infile outfile
-m .... method .......... method of filtering; mean or median; default=mean PURPOSE: To reduces the noise in an image. filter. DESCRIPTION: DENOISE reduces the noise in an image. It uses the formula: input + gain*(input - mean), where mean is a local mean computed in the neighborhood of each pixel and gain=max(0,(std-nstd)/std), where std is the local standard deviation computed in the neighborhood of each pixel. This is an implementation of the Lee Filter. See Lee, J.S., 1981. Speckle Analysis and Smoothing of Synthetic Aperture Radar Images. Computer Graphics and Image Processing, Vol. 17:24-32. ARGUMENTS: -m method ... METHOD of filtering. Choices are: mean or median. Default=mean. -f filter ... FILTER size. Values are floats>0. The default=2. -s subsection ... Subsection is a rectangular homogeneous region where the noise standard deviation will be computed if provided. Otherwise, nstd, must be provided. The values are in the form of the usual IM subsection expressed as WIDTHxHEIGHT+XOFF+YOFF. The default is no subsection provided. -n nstd ... NSTD is an estimate of the noise standard deviation in the image expressed as a percentage (of std values in the range of 0 to 1). Thus values for nstd are 0<=float<=100. The default is no nstd provided. Either one or the other of nstd or subsection must be provided. -u unsharp ... UNSHARP masking amount to apply as a post processing step to sharpen the image. Values are floats>=0. The default=0 for no unsharp masking. NOTE: This script will be a bit slow due to the use of -fx. CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
|
Create Noisy Images |
|
|
Clean Image |
|
|
|
|
Noisy Image 1 |
Noisy Image 2 |
|
|
|
Technique To Measure Noise Standard Deviation |
|
|
Noisy Image 2 |
Homogeneous Subsection |
|
|
|
Variation In Noise Amount |
|
|
Noisy Image 1 |
Arguments: |
|
|
|
Noisy Image 2 |
Arguments: |
|
|
|
Variation In Filter Size |
||
|
Noisy Image 2 |
||
|
||
|
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
Variation In Estimate Of Noise Standard Deviation |
||
|
Noisy Image 2 |
||
|
||
|
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
Comparison To Other Techniques |
||
|
Noisy Image 2 |
||
|
||
|
-despeckle |
-f 2 -s "20x20+203+152" |
-enhance |
|
|
|
|
Denoising Without And With Post-Sharpening |
||
|
Noisy Image 2 |
-f 2 -s "20x20+203+152" |
-f 2 -s "20x20+203+152" -u 1 |
|
|
|
|
Variation In Method: Mean vs Median |
||
|
Noisy Image 2 |
-f 2 -s "20x20+203+152" -m mean |
-f 2 -s "20x20+203+152" -m median |
|
|
|
|
What the script does is as follows for a edge sharpened image:
This is equivalent to the following IM commands:
|