A, Construction of a simple GLCM from a stylized 3 × 3 pixel image with 3 gray levels (Ng = 3); distance, d = 1 pixel; and direction, θ = 0° (ie, left or right only). We begin by identifying the reference pixel, with gray-level i, and counting the number of neighboring pixels with gray-level j. B, For example, looking at the second entry in the first row of the GLCM and counting n (0,1) we see 2 pixels with gray level = 0 that have left- or right-handed neighbors with gray level = 1. If we look at the entry for (i,j) =(1,2) we count 1 pixel with gray level = 1, which has a left- or right-handed neighbor with gray level = 2.