luispedro / mahotas

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

"Input data has unexpected types" - Bug in mahotas.features.lbp.lbp #124

Open fateh288 opened 3 years ago

fateh288 commented 3 years ago

Stack Trace -

Traceback (most recent call last):
  File "C:/MS/Courses/CSE 515 MWDB/Project/Phase1/main.py", line 41, in <module>
    elbp.local_binary_pattern(image1)
  File "C:\MS\Courses\CSE 515 MWDB\Project\Phase1\feature_extractor.py", line 66, in local_binary_pattern
    feature = lbp(image, radius=3, points=16)
  File "C:\Users\fateh\anaconda3\envs\Phase1\lib\site-packages\mahotas\features\lbp.py", line 151, in lbp
    codes = lbp_transform(image, radius, points, ignore_zeros=ignore_zeros, preserve_shape=False)
  File "C:\Users\fateh\anaconda3\envs\Phase1\lib\site-packages\mahotas\features\lbp.py", line 75, in lbp_transform
    select(shift(image, [radius*dy,radius*dx], order=1)))
  File "C:\Users\fateh\anaconda3\envs\Phase1\lib\site-packages\mahotas\interpolate.py", line 289, in shift
    _interpolate.zoom_shift(array, None, shift, output, order, mode2int[mode], cval)
RuntimeError: mahotas.zoom_shift: input data has unexpected types. This may be a bug in mahotas.

Code -

from mahotas.features.lbp import lbp
feature = lbp(image, radius=3, points=16)
print(image1.shape)

gives (64, 64) which is as expected (a 2d array)

print(type(image1)) 

gives <class 'numpy.ndarray'> which is as expected (i.e. 2-D numpy ndarray)

luispedro commented 3 years ago

Can you perhaps post the image?

What is the dtype (i.e., print(image.dtype)))?