MultiplicativeNoise
Targets:
image
volume
Image Types:uint8, float32
Apply multiplicative noise to the input image.
This transform multiplies each pixel in the image by a random value or array of values, effectively creating a noise pattern that scales with the image intensity.
Arguments
multipliertuple[float, float]
[0.9,1.1]
The range for the random multiplier. Defines the range from which the multiplier is sampled. Default: (0.9, 1.1)
per_channelbool
false
If True, use a different random multiplier for each channel. If False, use the same multiplier for all channels. Setting this to False is slightly faster. Default: False
elementwisebool
false
If True, generates a unique multiplier for each pixel. If False, generates a single multiplier (or one per channel if per_channel=True). Default: False
pfloat
0.5
Probability of applying the transform. Default: 0.5
Examples
>>> import numpy as np
>>> import albumentations as A
>>> image = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)
>>> transform = A.MultiplicativeNoise(multiplier=(0.9, 1.1), per_channel=True, p=1.0)
>>> result = transform(image=image)
>>> noisy_image = result["image"]Notes
- When elementwise=False and per_channel=False, a single multiplier is applied to the entire image.
- When elementwise=False and per_channel=True, each channel gets a different multiplier.
- When elementwise=True and per_channel=False, each pixel gets the same multiplier across all channels.
- When elementwise=True and per_channel=True, each pixel in each channel gets a unique multiplier.
- Setting per_channel=False is slightly faster, especially for larger images.
- This transform can be used to simulate various lighting conditions or to create noise that scales with image intensity.
References
- Multiplicative noisehttps://en.wikipedia.org/wiki/Multiplicative_noise