hydrax.image.Coefs#

final class hydrax.image.Coefs(coefs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])#

Bases: object

Dtype-agnostic coefficients for image representation and colorspace conversion.

Parameters:

coefs – Coefficient array.

Tip

Many useful predefined coefficients are provided: FRACTIONAL, IMAGENET_SRGB, IMAGENET_SRGB_ALPHA, balanced()

FRACTIONAL: Coefs = <hydrax.image.Coefs object>#

Coefficients to convert sRGB(A) data in the range [0, 255] to a floating point representation in the range [0.0, 1.0].

IMAGENET_SRGB: Coefs = <hydrax.image.Coefs object>#

ImageNet sRGB standardization coefficients for the input range of [0, 255] and no alpha channel.

IMAGENET_SRGB_ALPHA: Coefs = <hydrax.image.Coefs object>#

ImageNet sRGBA standardization coefficients for the input range of [0, 255] and alpha output in the range [0.0, 1.0].

static balanced(scale: float = 1.0, *, alpha: bool = False) Coefs#

Returns a set of coefficients for converting sRGB in the range [0, 255] to a balanced floating point representation in the range [-scale, scale].

Parameters:
  • scale – The scale of the balanced representation.

  • alpha – If True, alpha channel coefficients for output in the range [0.0, 1.0] are included.