rhsimplex / image-match

🎇 Quickly search over billions of images
2.94k stars 405 forks source link

linspace() got an unexpected keyword argument 'dtype' #16

Closed francescolorussi closed 8 years ago

francescolorussi commented 8 years ago

While I'm trying to run this code:

from image_match.goldberg import ImageSignature gis = ImageSignature() a = gis.generate_signature('/home/francesco/Scrivania/2.jpg') b = gis.generate_signature('/home/francesco/Scrivania/1.jpg') gis.normalized_distance(a, b)

I get this error:

~$ python '/home/francesco/Scrivania/imagematch.py' Traceback (most recent call last): File "/home/francesco/Scrivania/imagematch.py", line 3, in <module> a = gis.generate_signature('/home/francesco/Scrivania/2.jpg') File "/usr/local/lib/python2.7/dist-packages/image_match/goldberg.py", line 164, in generate_signature n=self.n, window=image_limits) File "/usr/local/lib/python2.7/dist-packages/image_match/goldberg.py", line 341, in compute_grid_points x_coords = np.linspace(window[0][0], window[0][1], n + 2, dtype=int)[1:-1] TypeError: linspace() got an unexpected keyword argument 'dtype'

rhsimplex commented 8 years ago

Hi @steven991 can you share the images you are using? The signature generation can fail if the image is very small, for instance. We should raise a more informative exception, though.

Could you also share what version of numpy you're using?

python -c "import numpy; print numpy.__version__"

francescolorussi commented 8 years ago

Ok thank you for the tip about numpy version, I probably solved the issue. I was using the two Mona Lisa images provided in the example, the problem is that I installed numpy through apt-get (apt-get install python-numpy) which gave me version 1.8.2. Now I installed Anaconda which comes with numpy 1.10.4 and everything works fine. Maybe obsolete numpy version?

rhsimplex commented 8 years ago

Glad to help