Guest User

a guest
Feb 19th, 2013
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python2
  3. from sys import argv
  4. from PIL import Image
  5. from scipy.cluster.vq import kmeans2
  6. import numpy
  8. _, path_in, k, path_out = argv
  9. img ='RGB')
  10. centroid, label = kmeans2(numpy.array(img.getdata()), int(k))
  11. centroid = numpy.around(centroid).astype('int')
  12. img.putdata([tuple(centroid[l]) for l in label])
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add to your ad blocker whitelist or disable your adblocking software.