:py:mod:`anomalib.data.utils.image` =================================== .. py:module:: anomalib.data.utils.image .. autoapi-nested-parse:: Image Utils. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: anomalib.data.utils.image.get_image_filenames anomalib.data.utils.image.read_image anomalib.data.utils.image.pad_nextpow2 .. py:function:: get_image_filenames(path: Union[str, pathlib.Path]) -> List[str] Get image filenames. :param path: Path to image or image-folder. :type path: Union[str, Path] :returns: List of image filenames :rtype: List[str] .. py:function:: read_image(path: Union[str, pathlib.Path]) -> numpy.ndarray Read image from disk in RGB format. :param path: path to the image file :type path: str, Path .. rubric:: Example >>> image = read_image("test_image.jpg") :returns: image as numpy array .. py:function:: pad_nextpow2(batch: torch.Tensor) -> torch.Tensor Compute required padding from input size and return padded images. Finds the largest dimension and computes a square image of dimensions that are of the power of 2. In case the image dimension is odd, it returns the image with an extra padding on one side. :param batch: Input images :type batch: Tensor :returns: Padded batch :rtype: batch