Re: Adding a little noise
Bob Friesenhahn <[email protected]> Tue, 2 Dec 2014 08:53:42 -0600 (CST)
| Newsgroups | gmane.comp.video.graphicsmagick.apis |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2 Dec 2014, Paul Schmidt wrote: > I am using Magick++ > > I would like to add some noise to an image, but the addNoise function adds > far too much noise. > > Using convert you can use -attenuate to cut it back, so how do we do this > with Magick++ which has no -attenuate option. > > I'm an old film guy and the addNoise makes it look like you took 35mm Tri-X, > pushed it about 4 stops then blew it up to about 16x20... > > > I'm more interested in grain that is barely noticeable. > > Any one have any ideas? Yes, you can use the quantumOperator() method. Specify the desired ChannelType argument (e.g. AllChannels) as well as the QuantumOperator argument (e.g. NoiseGaussianQuantumOp) with a relatively small rvalue such as 0.25 or 0.5 (I think 1.0 is full-range). The math looks like new_value = old_value + rvalue*noise where noise is a floating point value which flops around greater and less than zero. This can be tested from the GraphicsMagick command line like gm convert infile.ppm -operator All Noise-Gaussian '50%' outfile.ppm Probably we should add more versions of addNoise() and addNoiseChannel() which take a parameter for the degree of noise to add. Bob -- Bob Friesenhahn [email protected], http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk