Skip to content

dew.data.image_codec

Bounded RGB image decoding, shared by every source and image step.

NameSummary
as_rgbGrey, grey and alpha, RGB or RGBA pixels, 8 or 16 bits, as RGB uint8.
decode_imageDecode RGB uint8 pixels without EXIF rotation, optionally using a reduced JPEG decode.

function source

def as_rgb(pixels: np.ndarray) -> np.ndarray

Grey, grey and alpha, RGB or RGBA pixels, 8 or 16 bits, as RGB uint8.

Grey is replicated and a 16-bit sample kept to its high byte. An image with transparency is composited onto white, as img2dataset does for the url shards the online loader streams.

function source

def decode_image(encoded: bytes, *, at_least: int | None = None) -> np.ndarray

Decode RGB uint8 pixels without EXIF rotation, optionally using a reduced JPEG decode.