Table of Contents

Enum NoiseKind

Namespace
Egami.Operations
Assembly
Egami.dll

The noise AddNoise(NoiseKind, float, bool, ulong) adds: ImageMagick's +noise kinds, with values on 0..1 and the amount as ImageMagick's -attenuate. At amount 1 the formulas are ImageMagick's Q16 ones.

public enum NoiseKind

Fields

Gaussian = 0

Normal noise of standard deviation 5/64 × amount (about 20 of 255 levels at amount 1), plus a small part that grows with the value.

Impulse = 2

Salt and pepper: each value becomes 0 or 1, each with probability amount / 20.

Laplacian = 3

Laplacian (two-sided exponential) noise of scale 5/128 × amount: sharper peaked and heavier tailed than Gaussian.

Multiplicative = 4

Normal noise proportional to the value: v × (1 + amount / 4 × N(0, 1)), so dark areas stay clean.

Poisson = 5

Photon (shot) noise: a Poisson count of mean 12.5 × amount × v, scaled back, so the variance is v / (12.5 × amount).

Uniform = 1

Uniform noise, ±amount / 128.

Examples

// Film grain: gray Gaussian noise at a third of ImageMagick's default strength; the same seed gives the same grain.
photo.Apply(ops => ops.AddNoise(NoiseKind.Gaussian, 0.3f, monochrome: true, seed: 42), Ct);