CS6825: Computer Vision word cloud

Pixels and their Neighbors


As discussed before a digital image is composed of a set of pixels arranged in rows and columns. Each pixel shares borders with other pixels. For the pixel labeled (i,j) the neighboring pixels which share borders are highlighted in grey in the diagram below. These pixels are referred to as the 4-neighbors of pixel (i,j).

4-neighbors of pixel (i,j)



Recall that a pixel location is given by (row, column) and thus the surrounding pixels locations are illustrated below:


spatial relationship of pixel neighborhood

Thus, the pixel (i,j) has the 4-neighbors located at (i+1,j), (i-1,j), (i,j+1), and (i,j-1).

Similarly, we say two pixels are 8-neighbors if they share at least one corner. The following diagram shows the 8-neighbors for pixel (i,j) as highlighted in grey.

8-neighbors of pixel(i,j)
8-neighbors spatial relationship


Thus, the 8-neighbors of the pixel (i,j) include the 4-neighbors plus (i+1,j+1), (i+1,j-1), (i-1,j+1) and (i-1,j-1)

© Lynne Grewe