Closed jonaslund closed 10 years ago
My guess is that this is from the image. Can you post it?
I will change the example in the README to work with the provided demo images, though. I think this is an old example from when there were no demo images.
Don't think so based on this: Here's a similar error running the demo with the supplied images
demos 💪 python morphology.py
Traceback (most recent call last):
File "morphology.py", line 8, in <module>
T = mahotas.otsu(luispedro)
File "/mahotas-1.1.0-py2.7-macosx-10.9-intel.egg/mahotas/thresholding.py", line 95, in otsu
_verify_is_integer_type(img, 'otsu')
File "/mahotas-1.1.0-py2.7-macosx-10.9-intel.egg/mahotas/internal.py", line 140, in _verify_is_integer_type
raise TypeError('mahotas.%s: This function only accepts integer types (passed array of type %s)' % (function_name, A.dtype))
TypeError: mahotas.otsu: This function only accepts integer types (passed array of type float32)
Any ideas what the error might come from?
The proximal cause is that you are passing an array of floats instead of an array of integer values.
* Are you running the code in:
https://github.com/luispedro/mahotas/blob/master/mahotas/demos/morphology.py
? I find it a bit odd that you'd get these results.
(I just updated that old code too; the previous one would only work if it was run in the right directory, but otherwise it's the same computation).
I don't understand the error you are seeing, but I'd try looking at the type of the array luispedro
just before passing it to otsu (luispedro.dtype
) and eventually convert it (luispedro.astype(np.uint8)
).
HTH Luis
Just to add a quick comment. I had this same issue after trying to convert an image from one format to another. After installing PIL I was able to use the initial format type.
When running the example code
This error is returned
Any ideas?