s6.vision.preprocessΒΆ

s6.vision.preprocess.apply_ev(img: ndarray, ev_offset: float = 0.0, bias: float = 0.0) ndarray

Simulate exposure compensation on a numpy image array (no contrast/gamma changes).

Parameters:
  • img (np.ndarray) – Input image (uint8 or uint16, gray or color).

  • ev_offset (float) – Exposure value offset (-5 ~ +5). +1 doubles brightness.

  • bias (float) – Additive brightness offset (in pixel intensity units).

Returns:

Exposure-adjusted image (same shape and dtype as input).

Return type:

np.ndarray

s6.vision.preprocess.adjust_contrast(img: ndarray, contrast_ev: float = 0.0, midpoint: float | None = None, out_dtype: dtype | None = None) ndarray

Adjust contrast using a center-stretch model: out = (img - mid) * alpha + mid, alpha = 2 ** contrast_ev - Works for grayscale or color, any channel count. - Supports uint8/uint16/float32/float64. - If midpoint is None: uses half of the numeric range (128 for u8, 32768 for u16, 0.5 for [0,1] floats).