Python API
Introduction
In order to avoid generating useless files when working with data already in memory, a Python interface is published.
The package comes with a library, public interface of which is contained in module api.
For example, assuming the photometric channels are NumPy arrays i, y, j h, the RGB (or, rather, BGR image) is rendered as:
from azulero import api as azul
iyjh = np.stack([i, y, j, h])
bgr = azul.process_iyjh(iyjh)
API reference
- class azulero.api.Transform(
- iyjh_zero_points: tuple = (24.5, 29.8, 30.1, 30.0),
- iyjh_scaling: tuple = (2.2, 1.3, 1.2, 1.0),
- iyjh_fwhm: tuple = (1.6, 3.5, 3.4, 3.5),
- sharpen_strength: float = 0.5,
- nir_to_l: float = 0.2,
- i_to_b: float = 1.0,
- y_to_g: float = 0.5,
- j_to_r: float = 0.25,
- hue: float = -20.0,
- saturation: float = 1.2,
- stretch: float = 27.5,
- bw: tuple = (28.5, 22.5),
- neg_overshoot: float = 0.4,
- bgr_curves: tuple = ([(0.5, 0.55)], [], []),
Transformation parameters.
- Parameters:
iyjh_zero_points – Zero points of each channel
iyjh_scaling – Scaling of each channel (for white balance)
iyjh_fwhm – PSF full width at half-maximum of each channel
sharpen_strength – Unsharp masking strength
nir_to_l – NIR-to-L rate
i_to_b – I-to-B rate
y_to_g – Y-to-G rate
j_to_r – J-to-R rate
hue – Hue rotation angle in degrees
saturation – Saturation gain
stretch – Stretching parameter
neg_overshoot – Negative overshooting parameter
bw – Black and white points in AB-mag
bgr_curves – Curve adjustment knots for each channel
- azulero.api.process_iyjh(
- iyjh: ndarray,
- wcs: WCS | None = None,
- transform: Transform = Transform(),
- output: str = '',
Process an image according to transformation parameters, optionally save intermediate and final images.
- Parameters:
iyjh – A stack of the I, Y, J, H arrays (e.g.
iyjh[1]is the NIR-Y channel).wcs – The WCS parameters or
Nonetransform – The transformation parameters
output – The output file name (empty string to disable writing)
- Returns:
A normalized BGR image (OpenCV layout with bottom-up Y axis).