ZGainsforth
9/10/2014 - 11:13 PM

Bins an image when the image is a 2d numpy array.

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