LensFlare

Targets:
image
volume
Image Types:uint8, float32

Apply realistic lens flare effect with starburst rays and ghost reflections.

Simulates optical lens flare artifacts including a central bright spot with radiating starburst pattern and secondary ghost reflections along the axis from source to image center.

Arguments
flare_roi
tuple[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_range
tuple[int, int]
[3,7]

Range for number of ghost reflections. Default: (3, 7).

intensity_range
tuple[float, float]
[0.3,0.7]

Range for overall flare brightness. Default: (0.3, 0.7).

num_rays_range
tuple[int, int]
[4,8]

Range for number of starburst rays. Default: (4, 8).

bloom_range
tuple[float, float]
[0.01,0.05]

Range for bloom blur radius as fraction of image diagonal. Default: (0.01, 0.05).

p
float
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 appear along the line between the flare source and the image center, at mirrored positions. Their size decreases and color shifts slightly as they get farther from the source.