def contour2bbox(contour):
    """
        Calculate a bounding box from a contour

        Parameters
        ----------
        contour : array_like 
            a single contour

        Returns
        -------
        x and y points of each corner of the bounding box in image
        ymin,ymax,xmin,xmax
    """
    xmin, xmax = min(contour[:, (1)]), max(contour[:, (1)])
    ymin, ymax = min(contour[:, (0)]), max(contour[:, (0)])
    return ymin, ymax, xmin, xmax
