luispedro / mahotas

Computer Vision in Python
https://mahotas.rtfd.io
Other
839 stars 147 forks source link

Error in using the Zernike moments. #126

Open M-I-Dx opened 2 years ago

M-I-Dx commented 2 years ago

I am trying to get Zernike moments for some images but I keep getting the following error

AttributeError                            Traceback (most recent call last)
<ipython-input-33-6eb9b0e4463a> in <module>()
----> 1 get_moments(img, 10)

<ipython-input-32-b3923b47676f> in get_moments(image, radius)
      1 def get_moments(image, radius):
----> 2     moments = mahotas.features.zernike_moments(image, radius)
      3     return moments

AttributeError: module 'mahotas' has no attribute 'features'

Can you suggest the fix for this?

luispedro commented 2 years ago

What does your file look like? Did you import mahotas.features before this code?

M-I-Dx commented 2 years ago

If I import mahotas.features instead of just mahotas, I get the following error:

/usr/local/lib/python3.7/dist-packages/mahotas/features/__init__.py in <module>()
      4 #
      5 
----> 6 from .texture import haralick
      7 from .tas import tas, pftas
      8 from .zernike import zernike, zernike_moments

/usr/local/lib/python3.7/dist-packages/mahotas/features/texture.py in <module>()
      6 
      7 import numpy as np
----> 8 from . import _texture
      9 from ..internal import _verify_is_integer_type
     10 

ImportError: numpy.core.multiarray failed to import

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
luispedro commented 2 years ago

Does import numpy work on your system? This is some messed up installation. How did you install mahotas?

M-I-Dx commented 2 years ago

Yes, import numpy works. I am running it on google colabs. For installing mahotas, I just used pip install mahotas.

luispedro commented 2 years ago

Sorry, this seems like a messed up environment and I do not have any insights.

M-I-Dx commented 2 years ago

Ok. Thanks for your time. I will try it on my local system.