def get_image_filenames_from_dir(path: str | Path) -> list[Path]:
    """Get list of image filenames from directory.

    Args:
        path (str | Path): Path to directory containing images

    Returns:
        list[Path]: List of paths to image files

    Raises:
        ValueError: If path is not a directory or no images found

    Examples:
        >>> get_image_filenames_from_dir("images/")
        [PosixPath('images/001.jpg'), PosixPath('images/002.png')]

        >>> get_image_filenames_from_dir("empty/")
        Traceback (most recent call last):
            ...
        ValueError: Found 0 images in empty/
    """
    path = Path(path)
    if not path.is_dir():
        msg = f"Path is not a directory: {path}"
        raise ValueError(msg)

    image_filenames = [get_image_filename(f) for f in path.glob("**/*") if is_image_file(f)]

    if not image_filenames:
        msg = f"Found 0 images in {path}"
        raise ValueError(msg)

    return sorted(image_filenames)
Get list of image filenames from directory.

    Args:
        path (str | Path): Path to directory containing images

    Returns:
        list[Path]: List of paths to image files

    Raises:
        ValueError: If path is not a directory or no images found

    Examples:
        >>> get_image_filenames_from_dir("images/")
        [PosixPath('images/001.jpg'), PosixPath('images/002.png')]

        >>> get_image_filenames_from_dir("empty/")
        Traceback (most recent call last):
            ...
        ValueError: Found 0 images in empty/
    
src/anomalib/data/utils/image.py