              bottom += abs(top)
              top += abs(top)
  
          # Make sure box is always square.
          assert ((right - left) == (bottom - top)), 'Box is not square.'
  
          return [left, top, right, bottom]
  
 
</s> remove     def from_bounding_box(self, bounding_box, image=None):
        """ Set Bounding Box from a BoundingBox """
        logger.trace("Creating from BoundingBox: %s", bounding_box)
        if not isinstance(bounding_box, BoundingBox):
            raise ValueError("Supplied Bounding Box is not a BoundingBox.")
        self.x = bounding_box.left
        self.w = bounding_box.width
        self.y = bounding_box.top
        self.h = bounding_box.height
 </s> add     def from_bounding_box_dict(self, bounding_box_dict, image=None):
        """ Set Bounding Box from a bounding box dict """
        logger.trace("Creating from bounding box dict: %s", bounding_box_dict)
        if not isinstance(bounding_box_dict, dict):
            raise ValueError("Supplied Bounding Box is not a dictionary.")
        self.x = bounding_box_dict["left"]
        self.w = bounding_box_dict["right"] - bounding_box_dict["left"]
        self.y = bounding_box_dict["top"]
        self.h = bounding_box_dict["bottom"] - bounding_box_dict["top"] </s> remove 

class BoundingBox():
    """ Bounding box class """
    def __init__(self, left, top, right, bottom):
        logger.trace("Initializing %s: (left: %s, top: %s, right: %s, bottom: %s)",
                     self.__class__.__name__, left, top, right, bottom)
        self._box = (left, top, right, bottom)
        logger.trace("Initialized %s", self.__class__.__name__)

    @property
    def left(self):
        """ Return left point as int """
        return int(round(self._box[0]))

    @property
    def top(self):
        """ Return top point as int """
        return int(round(self._box[1]))

    @property
    def right(self):
        """ Return right point as int """
        return int(round(self._box[2]))

    @property
    def bottom(self):
        """ Return bottom point as int """
        return int(round(self._box[3]))

    @property
    def width(self):
        """ Return width of bounding box """
        return self.right - self.left

    @property
    def height(self):
        """ Return height of bounding box """
        return self.bottom - self.top
 </s> add  </s> remove     def set_predetected(width, height):
        """ Set a BoundingBox for predetected faces """
 </s> add     def to_bounding_box_dict(left, top, right, bottom):
        """ Return a dict for the bounding box """
        return dict(left=int(round(left)),
                    right=int(round(right)),
                    top=int(round(top)),
                    bottom=int(round(bottom)))

    def set_predetected(self, width, height):
        """ Set a bounding box dict for predetected faces """ </s> remove         box = (detected_face.left, detected_face.top, detected_face.right, detected_face.bottom)
        diff_height_width = detected_face.height - detected_face.width
 </s> add         box = (detected_face["left"],
               detected_face["top"],
               detected_face["right"],
               detected_face["bottom"])
        height = detected_face["bottom"] - detected_face["top"]
        width = detected_face["right"] - detected_face["left"]
        diff_height_width = height - width </s> remove         return [BoundingBox(0, 0, width, height)]
 </s> add         return [self.to_bounding_box_dict(0, 0, width, height)]
        print(right, left, bottom, top)
              bottom += abs(top)
              top += abs(top)
  
          # Make sure box is always square.
        print(right, left, bottom, top)
          assert ((right - left) == (bottom - top)), 'Box is not square.'
  
          return [left, top, right, bottom]
  
keep keep keep add keep keep keep keep
 Bugfix: Extract - Remove BoundingBox object and replace with dict 
plugins/extract/align/cv2_dnn.py