summaryrefslogtreecommitdiff
path: root/src/text_recognizer/datasets/util.py
blob: 6668eefaaccc995c96f061878432dc1e0aaee4cf (plain)
1
2
3
4
5
6
7
8
9
10
11
"""Util functions for datasets."""
import numpy as np
from PIL import Image


class Transpose:
    """Transposes the EMNIST image to the correct orientation."""

    def __call__(self, image: Image) -> np.ndarray:
        """Swaps axis."""
        return np.array(image).swapaxes(0, 1)