Anyone could help me to calculate the NDCOM for an image? The first part of the calculation was counting the number of pixels that had each intensity level, thus getting one value for each intensity level. The neighborhood distribution was then retrieved by assigning each intensity level a new value, the sum of the two previouslycounted number of pixels that had either of the neighboring intensity values (defined as all pixels that have a difference of value of 1 or -1). The extracted value was then the middle point where the accumulated number of neighbor intensity values was the same above and below.

NDCOM calculated separately for each color channel k \in {R,G,B} using histogram h_k = hist(x_k). Some of the equations which might help to understand: