[Numpy-discussion] position of objects?

Peter Verveer verveer at embl.de
Thu Jan 13 12:47:09 EST 2005


> Is there a way to obtain the positions (coordinates) of objects that 
> were found with find_objects() function (in nd_image)? Specifically 
> what I'm looking for is the coordinates of the bounding box (for a 2d 
> array it would be upper-left and lower-right).

The find_objects() functions returns for each object the slices that 
define the bounding box of each object. The slices are a tuple of slice 
objects, one slice object for each axis. The start and stop attributes 
of slice objects can be used to find exact position and size along each 
axis.

Cheers, Peter





More information about the NumPy-Discussion mailing list