LensFlare
Targets:
image
Image Types:uint8, float32
Add lens flare: starburst rays and ghost reflections from a bright source. Use for outdoor or backlit robustness and optical-artifact simulation.
A flare center is chosen in a configurable region; starburst rays and mirrored ghost circles are drawn toward the image center. Strength and blur are configurable.
Arguments
flare_roituple[float, float, float, float]
[0,0,1,0.5]
Region of interest for flare source placement as (x_min, y_min, x_max, y_max) in normalized [0, 1] coords. Default: (0, 0, 1, 0.5).
num_ghosts_rangetuple[int, int]
[3,7]
Range for number of ghost reflections. Default: (3, 7).
intensity_rangetuple[float, float]
[0.3,0.7]
Range for overall flare brightness. Default: (0.3, 0.7).
num_rays_rangetuple[int, int]
[4,8]
Range for number of starburst rays. Default: (4, 8).
bloom_rangetuple[float, float]
[0.01,0.05]
Range for bloom blur radius as fraction of image diagonal. Default: (0.01, 0.05).
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.LensFlare(intensity_range=(0.3, 0.6), p=1.0)
>>> result = transform(image=image)["image"]Notes
- Ghost reflections lie along the line from flare source to image center.
- Size decreases and color shifts with distance from the source.
See Also
- AtmosphericFog: Depth-dependent fog via scattering.
- RandomFog: Patch-based fog without depth.
- RandomRain: Rain streaks for rainy conditions.
- RandomSnow: Snow overlay for winter conditions.