Effects
effects
Image processing effects.
Functions:
-
XYZ_to_xyY–Converts from CIE XYZ to xyY.
-
add_canvas–Adds a background canvas to an image.
-
apply_grain–Applies a grain filter to an image.
-
blur_horizontal_masked–Horizontal blur with a mask.
-
blur_vertical_masked–Vertical blur with a mask.
-
burn–Simulates highlight burning, which is a darkroom printing technique to reduce
-
chroma_nr_filter–A simple chroma noise reduction filter by blurring only color channels.
-
compute_kernel_from_function–Computes a convolution kernel from a mtf function.
-
crop_image–Crops rgb data to aspect ratio.
-
down_up_blur–Blur by downsampling and then upsampling. Very fast on CPU compared to accurate
-
exponential_blur_kernel–Compute an exponential blur kernel for halation.
-
film_sharpness–Apply the sharpness and micro-contrast of a film stock ot an image.
-
gaussian_blur_separable_masked–image: (H, W, C) float32
-
gaussian_kernel_1d–A fast 1D gaussian kernel.
-
halation–A halation image processing effect.
-
lens_correction–Apply lens correction using lensfunpy.
-
mtf_curve–Turn mtf values into an interpolated function on log space.
-
mtf_kernel–Cache a mtf convolution kernel.
-
rotate–Rotate an image by a specified angle in degrees.
-
xyY_to_XYZ–Converts from CIE xyY to XYZ.
add_canvas
add_canvas(
image: ndarray,
canvas_mode: CANVAS_MODES,
canvas_scale: float = 1.0,
canvas_ratio: float = 1.0,
)
Adds a background canvas to an image.
apply_grain
apply_grain(
rgb: ndarray,
stock: FilmSpectral,
scale: float,
grain_size_mm: float = 0.01,
grain_sigma: float = 0.4,
bw_grain: bool = False,
adx: bool = True,
)
Applies a grain filter to an image.
blur_horizontal_masked
blur_horizontal_masked(image: ndarray, kernel: ndarray, blur_mask: ndarray)
Horizontal blur with a mask.
blur_vertical_masked
blur_vertical_masked(image: ndarray, kernel: ndarray, blur_mask: ndarray)
Vertical blur with a mask.
burn
Simulates highlight burning, which is a darkroom printing technique to reduce the contrast and brightness of highlights. Similar to modern local tone-mapping techniques.
chroma_nr_filter
chroma_nr_filter(image: ndarray, size: int = 0)
A simple chroma noise reduction filter by blurring only color channels.
compute_kernel_from_function
compute_kernel_from_function(func, kernel_size_mm, pixel_size_mm)
Computes a convolution kernel from a mtf function.
crop_image
crop_image(rgb: ndarray, zoom=1, aspect=1.5, flip=False) -> ndarray
Crops rgb data to aspect ratio.
down_up_blur
Blur by downsampling and then upsampling. Very fast on CPU compared to accurate blur filters.
exponential_blur_kernel
exponential_blur_kernel(size)
Compute an exponential blur kernel for halation.
film_sharpness
film_sharpness(
rgb: ndarray,
stock: FilmSpectral,
scale: float,
sharpening_strength,
sharpening_sigma,
)
Apply the sharpness and micro-contrast of a film stock ot an image.
gaussian_blur_separable_masked
gaussian_blur_separable_masked(image, kernel, blur_channels)
image: (H, W, C) float32 kernel: 1D Gaussian kernel blur_channels: iterable of booleans, length C
gaussian_kernel_1d
A fast 1D gaussian kernel.
halation
halation(
rgb: ndarray,
scale: float,
halation_size: float = 1.0,
halation_red_factor: float = 1.0,
halation_green_factor: float = 0.4,
halation_blue_factor: float = 0.0,
halation_intensity: float = 1.0,
bw: bool = False,
) -> ndarray
A halation image processing effect.
lens_correction
Apply lens correction using lensfunpy.
mtf_curve
mtf_curve(logf, vals)
Turn mtf values into an interpolated function on log space.
mtf_kernel
cached
mtf_kernel(
stock: FilmSpectral,
scale,
sharpening_strength: float = 0.0,
sharpening_sigma: float = 1.0,
)
Cache a mtf convolution kernel.
rotate
rotate(rgb: ndarray, degrees: float) -> ndarray
Rotate an image by a specified angle in degrees.