module
camera_modelIntroduces camera noise effects.
Contents
- Reference
This module systematically models the different noise sources present in modern digital cameras.
The implementation largely follows the work of A. Carlson et al.: Modeling Camera Effects to Improve Visual Learning from Synthetic Data (2018), arXiv
Typical usage
import stillleben as sl import torch # Input image (CHW) img = torch.rand(3, 1080, 1920) # Everything is much faster on GPU! img = img.cuda() # Apply noise img_with_noise = sl.camera_model.process_image(img)
Functions
- def chromatic_aberration(rgb, translations, scaling)
- Introduces chromatic aberration effects.
- def blur(rgb, sigma)
- Applies Gaussian blur
- def exposure(rgb, deltaS)
- Re-exposes the image
- def noise(rgb, a, b)
- Applies additional Poissonian-Gaussian noise
- def color_jitter(tensor_img, hue_shift)
- Hue shift.
- def process_deterministic(rgb, chromatic_translation, chromatic_scaling, blur_sigma, exposure_deltaS, do_noise, noise_a, noise_b, hue_shift)
- Process image with given noise model parameters.
- def process_image(rgb)
- Process image with random noise parameters.
Function documentation
def stillleben. camera_model. chromatic_aberration(rgb, translations, scaling)
Introduces chromatic aberration effects.
Parameters | |
---|---|
rgb | 3xHxW input RGB image |
translations | 3x2 translation tensor (tx, ty) for each of R, G, B |
scaling | [sr, sg, sb] scaling factor for each of R, G, B |
Returns | 3xHxW output tensor |
def stillleben. camera_model. blur(rgb, sigma)
Applies Gaussian blur
Parameters | |
---|---|
rgb | 3xHxW input RGB image |
sigma | Standard deviation of the Gaussian |
Returns | 3xHxW output RGB image |
def stillleben. camera_model. exposure(rgb, deltaS)
Re-exposes the image
Parameters | |
---|---|
rgb | 3xHxW input RGB image, float [0-1] |
deltaS | exposure shift (usually -1 to 1) |
Returns | 3xHxW output image |
def stillleben. camera_model. noise(rgb, a, b)
Applies additional Poissonian-Gaussian noise
Parameters | |
---|---|
rgb | 3xHxW input RGB image, float [0-1] |
a | variance factor of the signal-dependant noise (var = a*y(x)) |
b | standard deviation of the signal-independant noise |
Returns | modified image |
See Foi, Alessandro, et al. (2008): Practical Poissonian-Gaussian noise modeling and fitting for single-image raw-data, PDF
def stillleben. camera_model. color_jitter(tensor_img, hue_shift)
Hue shift.
Parameters | |
---|---|
tensor_img | 3xHxW RGB float tensor [0,1] |
hue_shift | hue shift to apply (-0.5 to 0.5) |
Returns | jittered image |