LowLightNoise#

class augraphy.augmentations.lowlightnoise.LowLightNoise(num_photons_range=(50, 100), alpha_range=(0.7, 1.0), beta_range=(10, 30), gamma_range=(1, 1.8), bias_range=(20, 40), dark_current_value=1.0, exposure_time=0.2, gain=0.1, p=1)[source]#

Bases: Augmentation

Simulate low-light conditions in an image by applying various noise effects.

Args:

num_photons_range (tuple): Range of the number of photons to simulate (default: (50, 100)). alpha_range (tuple): Range of alpha values for brightness adjustment (default: (0.2, 0.3)). beta_range (tuple): Range of beta values for brightness adjustment (default: (10, 30)). gamma_range (tuple): Range of gamma values for contrast adjustment (default: (1.0, 1.2)). bias_range (tuple): Range of bias values to add (default: (20, 40)). dark_current_value (float): Value for dark current simulation (default: 1.0). exposure_time (float): Length of the simulated exposure in seconds (default: 0.2). gain (float): Gain of the camera (default: 0.1). p (float): Probability of applying the augmentation (default: 1).

Overview#

The LowLightNoise Augmentation simulate low-light conditions in an image by applying various noise effects

Code example:

# import libraries
import cv2
import numpy as np
from augraphy import *


# create a clean image with single line of text
image = np.full((500, 1500,3), 250, dtype="uint8")
cv2.putText(
    image,
    "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
    (80, 250),
    cv2.FONT_HERSHEY_SIMPLEX,
    1.5,
    0,
    3,
)

cv2.imshow("Input image", image)

Clean image:

../../../_images/input.png

Example 1#

In this example, we demonstrate the usage of the LowLightNoise augmentation. This augmentation is designed to simulate low-light conditions captured by a camera in images by introducing various noise components. By default, the number of photons camptured by the camera is typically set between 50 and 100 by default, determining the lighting conditions in the environment. The alpha,beta and gamma is set between (0.7 ,1.0) ,(10,30) and (1.0. 1.8) respectively which is used to transform the brightness and contrast of an image.

Code example:

lowlightnoise_obj = LowLightNoise(
    num_photons_range = (50, 100),
    alpha_range = (0.7, 0.9),
    beta_range = (10, 30),
    gamma_range = (1.0 , 1.8)
)

lowlightnoise_img = lowlightnoise_obj(image)
cv2.imshow("LowLightNoise Augmentation", lowlightnoise_img)

Augmented image:

../../../_images/lowlightnoise.png