Skip to content

Instantly share code, notes, and snippets.

@ZGainsforth
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save ZGainsforth/604a906bad527728e439 to your computer and use it in GitHub Desktop.

Select an option

Save ZGainsforth/604a906bad527728e439 to your computer and use it in GitHub Desktop.
Bins an image when the image is a 2d numpy array.
def BinImage(img, binsize):
imgbin = zeros(array(img.shape)/binsize)
for i in range(binsize):
for j in range(binsize):
imgbin += img[i::binsize, j::binsize]
return imgbin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment