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.
flare_roiRegion 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_rangeRange for number of ghost reflections. Default: (3, 7).
intensity_rangeRange for overall flare brightness. Default: (0.3, 0.7).
num_rays_rangeRange for number of starburst rays. Default: (4, 8).
bloom_rangeRange for bloom blur radius as fraction of image diagonal. Default: (0.01, 0.05).
pProbability of applying the transform. Default: 0.5.
>>> 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"]