Chromatic Aberration Transform in Albumentations 1.4.2
Vladimir Iglovikov
Posted on March 20, 2024
Albumentations 1.4.2 adds the Chromatic Aberration transform. This feature simulates the common lens aberration effect, causing color fringes in images due to the lens's inability to focus all colors at the same convergence point.
Understanding Chromatic Aberration
Chromatic Aberration results from lens dispersion, where light of different wavelengths refracts at slightly varied angles.
The Albumentations library introduces this as a visual effect rather than a precise optical simulation, offering two modes to mimic the appearance of chromatic aberration: green_purple
and red_blue
.
Enhancing Model Robustness
Applying the Chromatic Aberration transform can increase a model's robustness to real-world imaging conditions. It's particularly relevant for:
- High-contrast scenes
- Wide apertures photography
- Telephoto lens usage
- Digital zooming
- Underwater and action photography
Code Example
Original image
transform = A.Compose([A.ChromaticAberration(mode="red_blue",
primary_distortion_limit=0.5,
secondary_distortion_limit=0.1,
p=1)], p=1)
transformed = transform(image=img)["image"]
Or as a part of the more general pipeline.
transform = A.Compose([
A.RandomCrop(height=300, width=200, p=1),
A.HorizontalFlip(p=0.5),
A.ChromaticAberration(p=0.5,
primary_distortion_limit=0.5,
secondary_distortion_limit=0.1,
mode='random'),
A.GaussNoise(p=0.5)
])
Posted on March 20, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.