def pair_id_to_image_ids(pair_id):
    """Get image ids from pair id. (Taken from colmap)

    Args:
        pair_id (int): image pair id

    Returns:
        tuple: id of first image, id of second image
    """
    image_id2 = pair_id % 2147483647
    image_id1 = (pair_id - image_id2) / 2147483647

    return int(image_id1), int(image_id2)