Handling mis-shapen icons.

This commit is contained in:
Samuel Clay 2016-02-16 13:24:09 -08:00
parent 61fb9f1719
commit e1cf12888a

View file

@ -326,9 +326,9 @@ class IconImporter(object):
# Reshape array of values to merge color bands. [[R], [G], [B], [A]] => [R, G, B, A]
if len(shape) > 2:
ar = ar.reshape(scipy.product(shape[:2]), shape[2])
ar = ar.astype(numpy.float)
# Get NUM_CLUSTERS worth of centroids.
ar = ar.astype(numpy.float)
codes, _ = scipy.cluster.vq.kmeans(ar, NUM_CLUSTERS)
# Pare centroids, removing blacks and whites and shades of really dark and really light.