from typing import Dict


def read_image_dictionary(filename: str) -> Dict[int, str]:
    """Create image dictionary from file; useful for ETH3D dataset reading and conversion.

    Args:
        filename: input dictionary text file path

    Returns:
        Dictionary of image id (int) and corresponding image file name (string)
    """
    image_dict: Dict[int, str] = {}
    with open(filename) as f:
        num_entries = int(f.readline().strip())
        for _ in range(num_entries):
            parts = f.readline().strip().split(' ')
            image_dict[int(parts[0].strip())] = parts[1].strip()
    return image_dict