dew.data.image_codec
Bounded RGB image decoding, shared by every source and image step.
| Name | Summary |
|---|---|
as_rgb | Grey, grey and alpha, RGB or RGBA pixels, 8 or 16 bits, as RGB uint8. |
decode_image | Decode RGB uint8 pixels without EXIF rotation, optionally using a reduced JPEG decode. |
as_rgb
Section titled “as_rgb”def as_rgb(pixels: np.ndarray) -> np.ndarrayGrey, 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.
decode_image
Section titled “decode_image”def decode_image(encoded: bytes, *, at_least: int | None = None) -> np.ndarrayDecode RGB uint8 pixels without EXIF rotation, optionally using a reduced JPEG decode.