def _pixel_distance(a_x1, a_x2, b_x1, b_x2):
    """Calculates the pixel distance between bounding box a and b.

    Args:
      a_x1: The x1 coordinate of box a.
      a_x2: The x2 coordinate of box a.
      b_x1: The x1 coordinate of box b.
      b_x2: The x2 coordinate of box b.

    Returns:
      The pixel distance between box a and b on the x axis. The distance
      on the y axis can be calculated in the same way. The distance can be
      positive number (b is right/bottom to a) and negative number
      (b is left or top to a).
    """
    # if a and b are close enough, then we set the their distance to be 1
    # because there are typically padding spaces inside an object's bounding box
    if b_x1 <= a_x2 and a_x2 - b_x1 <= 100:  # config.ADJACENT_BOUNDING_BOX_THRESHOLD:
        return 1
    if a_x1 <= b_x2 and b_x2 - a_x1 <= 100:  # config.ADJACENT_BOUNDING_BOX_THRESHOLD:
        return -1
    # overlap
    if (a_x1 <= b_x1 <= a_x2) or (a_x1 <= b_x2 <= a_x2) or (
            b_x1 <= a_x1 <= b_x2) or (b_x1 <= a_x2 <= b_x2):
        return 0
    elif b_x1 > a_x2:
        return b_x1 - a_x2
    else:
        return b_x2 - a_x1