[Numpy-discussion] numarray.nd_image.label() help
Russell E Owen
rowen at u.washington.edu
Wed Jun 2 12:43:03 CDT 2004
At 2:49 PM +0200 2004-06-02, Andrew Wilson wrote:
>Hello,
> I'm having some trouble with the numarray.nd_image.label()
>function as it is not connecting two objects (that are adjacent) on
>some images. I have tried using the struct:
> [[1,1,1]
>struct = [1,1,1]
> [1,1,1]]
>
>this does change how it is connecting various objects in my image
>(as compared to the default struct) but it still splits the objects
>eventhough they are touching. Any hints or clues? I could send the
>pictures, just don't want to post them to the entire list.
I use it and have not (yet) noticed this, so I hope it's something
you're doing and not a bug.
You could try generating a boolean version of your image, examine
that to make sure the objects are still adjacent on that and use
label on it. Here's my code:
import numarray as num
# smoothed data is a median-filtered version of my image
# dataCut is a value above which pixels are considered data
shapeArry = num.ones((3,3))
labels, numElts = num.nd_image.label(smoothedData>dataCut, shapeArry)
If this doesn't do it (and nobody has anything better to offer),
please put the image up somewhere that we can access it and show us
your code.
-- Russell
More information about the Numpy-discussion
mailing list