Discussion:
mahotas. watershed
Andi G
2013-05-24 09:48:05 UTC
Permalink
Dear Mr. Pedro,
I tested your Python module mahotas and especially the function
mahotas.cwatershed, but I have a problem with the imput parameter image. It
works well if i use the whole imported image of the one i added in this
mail. But if use a small fraction of the image it doesn't work. I couldn't
find out why.
I would be glad, if you could please test my code and respond to it.
Greetings,
Andreas Grafl

Python Code:

import numpy, mahotas, PIL
from PIL import Image
img = Image.open("71895233_DTM_n_slope.tif")
imga = numpy.array(img)
He = imga < 15
He = He + 0
## Application of cwatershed with Image He
MarkerHe = mahotas.label(He <1)
MarkerHe = MarkerHe[0]
W,Wl = mahotas.cwatershed(He,MarkerHe,Bc=None,return_lines=True)
imgHe = Image.fromarray(Wl*1000)
imgHe.show()
## Application of cwatershed with a part of the Image He
Hex = He[100:2400,100:2400]
MarkerHex = mahotas.label(Hex <1)
MarkerHex = MarkerHex[0]
W,Wl = mahotas.cwatershed(Hex,MarkerHex,Bc=None,return_lines=True)
imgHe = Image.fromarray(Wl*1000)
imgHe.show()
## Application of cwatershed with another, smaller part of the Image He,
that does'nt work
Hey = He[800:1100,800:1100]
MarkerHey = mahotas.label(Hey <1)
MarkerHey = MarkerHey[0]
W,Wl = mahotas.cwatershed(Hey,MarkerHey,Bc=None,return_lines=True)
imgHe = Image.fromarray(Wl*1000)
imgHe.show()
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...