nrtk.impls.perturb_image.generic.PIL.enhance
Implements PerturbImage enhancers using PIL to adjust brightness, color, contrast, and sharpness of images.
- Classes:
BrightnessPerturber: Adjusts the brightness of an image. ColorPerturber: Adjusts the color balance of an image. ContrastPerturber: Adjusts the contrast of an image. SharpnessPerturber: Adjusts the sharpness of an image.
- Dependencies:
numpy for image data handling.
PIL (Pillow) for image enhancements.
typing_extensions for type checking and enhancements.
- Usage:
Instantiate any of the enhancement classes with a specific enhancement factor, then call perturb to apply the desired enhancement to an input image.
- Example:
brightness_perturber = BrightnessPerturber(factor=1.5) brighter_image, boxes = brightness_perturber(input_image, boxes)
contrast_perturber = ContrastPerturber(factor=0.8) contrasted_image, boxes = contrast_perturber(input_image, boxes)
- Notes:
Each enhancement class has a default factor of 1.0, which applies no change to the image.
SharpnessPerturber enforces a factor range of [0.0, 2.0].
The boxes returned from perturb are identical to the boxes passed in.
Classes
Adjusts image stimulus brightness. |
|
Adjusts image stimulus color balance. |
|
Adjusts image stimulus contrast. |
|
Adjusts image stimulus sharpness. |