Grey Level Co-Occurrence Matrix // Python
The simplest way for binning 8-bits images is to divide each value by 32. Then each pixel value is going to be in [0,8[.
Btw, more than avoiding sparse matrices (which are not really an issue), binning makes the GLCM more robust to noise.
I am trying to find the GLCM of an image using greycomatrix from skimage library. I am having issues with the selection of levels. Since it's an 8-bit image, the obvious selection should be 256; however, if I select values such as 8 (for the purpose of binning and to prevent sparse matrices from forming), I am getting errors. 
QUESTIONS:

Does anyone know why?
Can anyone suggest any ideas of binning these values into a 8x8 matrix instead of a 256x256 one?