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'
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)
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)