Standard "unit" for -evaluate Gaussian-noise[SOLVED]

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Toki
Posts: 3
Joined: 2013-09-12T17:01:51-07:00
Authentication code: 6789

Standard "unit" for -evaluate Gaussian-noise[SOLVED]

Post by Toki »

Hi everybody,

I'm using -evaluate Gaussian-noise to add noise to some images like this:

Code: Select all

convert ./woman_blonde.tif -evaluate Gaussian-noise 5 ./woman_blonde_50.tif 
And this works fine, it adds the noise and I can control the amount of noise added.

Problem is I'm unsure what exactly the 5 in

Code: Select all

-evaluate Gaussian-noise 5
does.
What is 5? Does it mean 5%?

In gimp you can add Gaussian blur, they control the intensity of it by having a standard deviation that ranges from 0 - 50. does ImageMagick use something similar?

Thanks,
Yathindu
Last edited by Toki on 2013-09-12T19:45:21-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Standard "unit" for -evaluate Gaussian-noise

Post by fmw42 »

It is a gain or attenuation factor for noise amplitude. It is the same as using -attenuate 5 +noise Gaussian.

http://www.imagemagick.org/script/comma ... p#evaluate

http://www.imagemagick.org/script/comma ... #attenuate

http://www.imagemagick.org/script/comma ... .php#noise
http://www.imagemagick.org/Usage/canvas/#random

So 1 is the equivalent of 100% in GIMP, I would presume. So if you want to halve the amplitude in IM it would 0.5 and in GIMP it would be 50%, I presume. But it is just a relative factor. Base amplitude in each may not be equivalent. So you may not get the exact same amplitude of noise in the corresponding cases.

Also note there is in IM -seed, which sets the seed for the randomness. If you want a reproducible result, you should set some seed value otherwise, you will get a different seed value by default if it is left off.

see

http://www.imagemagick.org/script/comma ... s.php#seed
Toki
Posts: 3
Joined: 2013-09-12T17:01:51-07:00
Authentication code: 6789

Re: Standard "unit" for -evaluate Gaussian-noise

Post by Toki »

Thanks for the quick reply. I didn't know about seed.

Problem is when I try:

Code: Select all

convert ./foo.tif -evaluate Gaussian-noise 1 ./fooNoise.tif
The generated image has no noise visible at all.
foo.tif - Image
fooNoise.tif - Image

However, if I use

Code: Select all

convert ./foo.tif -evaluate Gaussian-noise 2 ./fooNoise.tif
:
fooNoise.tif - Image
Now there a little bit of noise visible.

It doesn't seem that 1 is the maximum noise. If it matters foo.tif has a pixel depth of 1.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Standard "unit" for -evaluate Gaussian-noise

Post by fmw42 »

It doesn't seem that 1 is the maximum noise. If it matters foo.tif has a pixel depth of 1.
It is not. You can increase or decrease the value. "Maximum noise" must be an error or it has been changed since that documentation.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Standard "unit" for -evaluate Gaussian-noise

Post by snibgo »

"1" certainly isn't the maximum. For Gaussian noise, I use the rule of thumb that 100 totally obscures the image. So it's a bit like a percentage, although visually it isn't linear.
snibgo's IM pages: im.snibgo.com
Toki
Posts: 3
Joined: 2013-09-12T17:01:51-07:00
Authentication code: 6789

Re: Standard "unit" for -evaluate Gaussian-noise

Post by Toki »

Thanks for the clarification guys! :D
Post Reply