def extract_image_number(filename: str, from_file: bool) -> int:
    """
    finds the number of the image from the original images of LITIV 2014 dataset.
    :param filename: name of the image file.
    :param from_file: filename is read from a ground-truth file or not.
    :return: number.
    """
    number = filename[-8:-4]
    if from_file:
        number = filename[-9:-5]
    if not number.isdigit():
        number = number[-3:]
        if not number.isdigit():
            number = number[-2:]
    return int(number)