@classmethod
def from_string(cls, bounding_box_string):
    """
        Creates an instance of the bounding box by giving a string.
        :param bounding_box_string: string of the format "x,y,width,height"
        :return: instance of boundingbox matching the string.
        """
    bbox_elements = bounding_box_string.split(',')
    if len(bbox_elements) != 4:
        raise Exception("bounding box string doesn't contain a bounding box.")
    x = int(bbox_elements[0].strip())
    y = int(bbox_elements[1].strip())
    width = int(bbox_elements[2].strip())
    height = int(bbox_elements[3].strip())
    result = cls(x, y, width, height)
    return result
