Add lateral chromatic aberration: shift red/blue channels relative to green. Simulates lens color fringing via primary/secondary distortion ranges.
Chromatic aberration is an optical effect that occurs when a lens fails to focus all colors to the same point. This transform simulates this effect by applying different radial distortions to the red and blue channels of the image, while leaving the green channel unchanged.
primary_distortion_rangeRange of the primary radial distortion coefficient, sampled per image. Controls distortion in the center of the image:
secondary_distortion_rangeRange of the secondary radial distortion coefficient, sampled per image. Controls distortion in the corners:
modeType of color fringing to apply. Options are:
interpolationFlag specifying the interpolation algorithm. Should be one of: cv2.INTER_NEAREST, cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_AREA, cv2.INTER_LANCZOS4. Default: cv2.INTER_LINEAR.
pProbability of applying the transform. Should be in the range [0, 1]. Default: 0.5.
>>> import albumentations as A
>>> import cv2
>>> transform = A.ChromaticAberration(
... primary_distortion_range=(-0.05, 0.05),
... secondary_distortion_range=(-0.1, 0.1),
... mode='green_purple',
... interpolation=cv2.INTER_LINEAR,
... p=1.0,
... )
>>> transformed = transform(image=image)
>>> aberrated_image = transformed['image']