Ejemplo n.º 1
0
Archivo: bbox.py Proyecto: sdsk/mahotas
def bbox(img):
    """
    min1,max1,min2,max2 = bbox(img)

    Calculate the bounding box of image img.

    Parameters
    ----------
      img : Any image type
    Returns
    -------
      min1,max1,min2,max2 : These are such that img[min1:max1, min2:max2]
                            contains all non-zero pixels
    """
    if not img.shape:
        return np.array([], dtype=np.intp)
    if len(img.shape) == 2:
        return _bbox.bbox(img)
    raise NotImplementedError, 'mahotas.bbox for images of more than 2 dimensions'
Ejemplo n.º 2
0
def bbox(img):
    """
    min1,max1,min2,max2 = bbox(img)

    Calculate the bounding box of image img.

    Parameters
    ----------
      img : Any image type

    Returns
    -------
      min1,max1,min2,max2 : These are such that img[min1:max1, min2:max2]
                            contains all non-zero pixels
    """
    _verify_is_integer_type(img, 'mahotas.bbox')
    if not img.shape:
        return np.array([], dtype=np.intp)
    return _bbox.bbox(img)
Ejemplo n.º 3
0
def bbox(img):
    """
    min1,max1,min2,max2 = bbox(img)

    Calculate the bounding box of image img.

    Parameters
    ----------
    img : ndarray
        Any integer image type

    Returns
    -------
    min1,max1,min2,max2 : int,int,int,int
        These are such that ``img[min1:max1, min2:max2]`` contains all non-zero
        pixels
    """
    if not img.shape:
        return np.array([], dtype=np.intp)
    return _bbox.bbox(img)
Ejemplo n.º 4
0
def bbox(img):
    """
    min1,max1,min2,max2 = bbox(img)

    Calculate the bounding box of image img.

    Parameters
    ----------
    img : ndarray
        Any integer image type

    Returns
    -------
    min1,max1,min2,max2 : int,int,int,int
        These are such that ``img[min1:max1, min2:max2]`` contains all non-zero
        pixels
    """
    if not img.shape:
        return np.array([], dtype=np.intp)
    return _bbox.bbox(img)