Computer vision

The neighbourhood of a pixel is the collection of pixels which surround it. The neighbourhood of a pixel is required for operations such as morphology, edge detection, median filter, etc.

Many computer vision algorithms allow the programmer to choose an arbitrary neighborhood. Such algorithms typically create a new image by calculating each new pixel value as a function of not only the corresponding old pixel value, but also its neighboring old pixel values. The neighborhood around a pixel is also often called a "window" or "peephole" around that pixel. The non-zero entries in a "convolution kernel" form one kind of neighborhood. A morphological structuring element is another kind of neighborhood.

"Square Neighbourhoods" (3 by 3, 5 by 5) are often used, but circular neighbourhoods are used too.

Pixels in neighbourhoods are often numbered in a anticlockwise spiral, with 0 at the center.