×
☰ Menu

Neighbours of a Pixel

A pixel p at coordinates (x, y) has four horizontal and vertical neighbours whose coordinates are given by

This set of pixels is called the 4-neighbours of p, is denoted by N4(p)

(x + 1, y), (x − 1, y), (x, y + 1), (x, y − 1)

 

Diagonal neighbours of pixel p is denoted by ND(p), Whose coordinates are given by

(x + 1, y + 1), (x + 1, y— 1), (x — 1, y + 1), (x— 1, y— 1)

 

8-neighbours of pixel is denoted by N8(p) are combination of 4-neighbours and Diagonal neighbours of pixel.

N4(p) + ND(p) =N8(p)

The 8-neighbours of p Coordinates of 8-neighbours of pixel p are given by

(x + 1, y), (x + 1, y + 1), (x − 1, y), (x + 1, y— 1),  (x, y + 1), (x — 1, y + 1),  (x, y − 1), (x— 1, y— 1)