Neighbourhoods can be any shape, but usually they are rectangular.
This is a grey scale transformation or mapping. The simplest case is thresholding where the intensity profile is replaced by a step function, active at a chosen threshold value. In this case any pixel with a grey level below the threshold in the input image gets mapped to 0 in the output image. Other pixels are mapped to 255. Histogram Equalization Histogram equalization is a common technique for enhancing the appearance of images.