PlasmaShadow
Targets:
image
volume
Image Types:uint8, float32
Apply plasma-based shadow effect to the image using Diamond-Square algorithm.
Creates organic-looking shadows using plasma fractal noise pattern. The shadow intensity varies smoothly across the image, creating natural-looking darkening effects that can simulate shadows, shading, or lighting variations.
Arguments
shadow_intensity_rangetuple[float, float]
[0.3,0.7]
Range for shadow intensity. Values between 0 and 1:
- 0 means no shadow (original image)
- 1 means maximum darkening (black)
- Values between create partial shadows Default: (0.3, 0.7)
roughnessfloat
3
Controls how quickly the noise amplitude increases at each iteration. Must be greater than 0:
- Low values (< 1.0): Smoother, more gradual shadows
- Medium values (~2.0): Natural-looking shadows
- High values (> 3.0): Very rough, noisy shadows Default: 3.0
pfloat
0.5
Probability of applying the transform. Default: 0.5.
Examples
>>> import albumentations as A
>>> import numpy as np
# Default parameters for natural shadows
>>> transform = A.PlasmaShadow(p=1.0)
# Subtle, smooth shadows
>>> transform = A.PlasmaShadow(
... shadow_intensity_range=(0.1, 0.3),
... roughness=0.7,
... p=1.0
... )
# Dramatic, detailed shadows
>>> transform = A.PlasmaShadow(
... shadow_intensity_range=(0.5, 0.9),
... roughness=0.3,
... p=1.0
... )Notes
- The transform darkens the image using a plasma pattern
- Works with any number of channels (grayscale, RGB, multispectral)
- Shadow pattern is generated using Diamond-Square algorithm with specific kernels
- The same shadow pattern is applied to all channels
- Final values are clipped to valid range [0, max_value]
See Also
- PlasmaBrightnessContrast: For brightness/contrast adjustments using plasma patterns
- RandomShadow: For geometric shadow effects
- RandomToneCurve: For global lighting adjustments
- PlasmaBrightnessContrast: For brightness/contrast adjustments using plasma patterns
References
- [{'description': 'Fournier, Fussell, and Carpenter, "Computer rendering of stochastic models,"', 'source': 'Communications of the ACM, 1982. Paper introducing the Diamond-Square algorithm.'}, {'description': 'Diamond-Square algorithm', 'source': 'https://en.wikipedia.org/wiki/Diamond-square_algorithm'}]