Once an image is digitized, only a matrix of values remains. Pixel geometry is often lost.
- Pixels may not be square, and capture and reproduction devices may not share the same pixel geometry
- A mismatch between input and output pixel geometry causes geometric distortion
- Final geometry depends on how pixels are arranged in the output device
- Size, resolution and aspect ratio all need to be considered
Connectivity
Connectivity establishes the boundaries of objects, components and regions in an image.
2 pixels are connected iff they’re adjacent to each other and satisfy some similarity in grey level, given a similarity set .
- 4-connectivity
Adjacency restricted to the 4 pixels sharing an edge. - 8-connectivity
Adjacency extended to the 4 pixels sharing only a corner.
Path
A path between 2 pixels is a sequence of adjacent pixels connecting them.
Neighborhood
A local neighborhood is a sample window selecting the pixels around a given pixel , used when an operation depends on a group of adjacent pixels.
Resampling Neighbourhoods
Image resampling finds a source position for each pixel in a new grid. A non-integer source position lies inside a neighbourhood of source pixels.
Nearest Neighbour
Nearest-neighbour resampling copies the value of the closest source pixel. It preserves source values but creates blocky regions when enlarging an image.
The target output pixel maps backward to source coordinate between the source-pixel centres. Its distance to the centre of is . Its distance to the centre of is . The pixel is closest, so nearest-neighbour resampling copies to the output.
Bilinear Interpolation
Bilinear interpolation forms a weighted sum of the surrounding pixels. Each weight decreases with distance from the source position.
The distance-based weights are , , and . Their weighted sum is , which rounds to output value .
Distance Measures
For 2 pixels and :
Euclidean Distance
Straight-line distance between and .
City-Block Distance
Also known as Manhattan distance. Straight-line distance along the grid.
Chessboard Distance
Connectivity Correspondence
Each metric equals the length of the shortest path allowed by its matching connectivity.
- matches 4-connectivity
Pixels within of are and its 4 edge-sharing neighbors. A minimal path moves only horizontally and vertically. - matches 8-connectivity
Pixels within of are and all 8 surrounding pixels. A minimal path may also move diagonally.
has no such grid correspondence, since its unit disc is not aligned to the pixel lattice.
Worked Example
Pixel Distances
Find the distances from to .
Solution Reveal Hide
A shortest 4-path has moves. A shortest 8-path has moves.