← Back to all transforms
MultiplicativeNoise
Description
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. Args: multiplier (tuple[float, float]): The range for the random multiplier. Defines the range from which the multiplier is sampled. Default: (0.9, 1.1) per_channel (bool): 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 elementwise (bool): 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 p (float): Probability of applying the transform. Default: 0.5 Targets: image Image types: uint8, float32 Number of channels: Any Note: - 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. Example: >>> 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"] References: - Multiplicative noise: https://en.wikipedia.org/wiki/Multiplicative_noise
Parameters
- multiplier: tuple[float, float] (default: (0.9, 1.1))
- per_channel: bool (default: false)
- elementwise: bool (default: false)
- p: float (default: 0.5)
Targets
- Image
Try it out
ⓘ
Original Image:
Result:
Transform result will appear here