danielballan / photomosaic

Assemble thumbnail-sized images from a large collection into a tiling which, viewed at a distance, gives the impression of one large photo.
http://danielballan.github.io/photomosaic/docs/
BSD 3-Clause "New" or "Revised" License
57 stars 13 forks source link

error on dominant_color method #7

Closed filmo closed 8 years ago

filmo commented 8 years ago

Windows 10 Anaconda 2.7.10 SciPy 0.16.0

In order to get it to run I had to change:

import Image import ImageFilter

to

from PIL import Image from PIL import ImageFilter

Not sure if that effects the error I'm seeing below:

I'm getting the following error when trying to process images:

File "C:\Anaconda2\lib\site-packages\scipy\cluster\vq.py", line 436, in _kmeans code_book, has_members = _vq.update_cluster_means(obs, obs_code, nc) File "scipy\cluster_vq.pyx", line 347, in scipy.cluster._vq.update_cluster_means (scipy\cluster_vq.c:4550) TypeError: type other than float or double not supported

It doesn't like the following line of code:

colors, dist = vq.kmeans(imgarr, clusters)

Fix seems to be:

colors, dist = vq.kmeans(imgarr.astype(np.float), clusters)

danielballan commented 8 years ago

Thanks. As I said in #8, apologies for not getting to this in a timely fashion. In my re-write for v0.2.0, I use skimage.img_as_float to address this problem.