# How to find the Gray Level Co-occurrence Matrix (GLCM) of a given matrix?

I need to calculate the Gray Level Co-occurrence Matrix (GLCM) of a given matrix. In Matlab there is a built-in function to do this. However, it only considers the co-occurrence along the horizontal direction.

Is there any such function in Mathematica?

If not, how to find the GLCM which will consider the co-occurrence along any arbitrary direction and with any arbitrary kernel size(to consider the neighbors)?

From the documentation for ImageCooccurrence
MatrixPlot[