Image sampling grids

This web page contains images of sampling grid patterns that one might use when creating a digital camera image sensor. It accompanies an article I wrote for the Usenet "rec.photo.digital" newsgroup. You can read the original article here.

Although the following images have different row and column spacings, one thing is kept constant for all of them: the distance from any one pixel to its nearest neighbour is always the same (1 unit in some arbitrary measurement system). In photographic terms, this means that the minimum spatial resolution (for a pattern in the worst-case orientation) of all of these patterns is the same.

1. Square grid

square grid
This shows a plain square grid. Most digital cameras use this sensor organization. The red lines show how the grid is related to tiling the plane with squares.

Every pixel has four neighbours at distance 1, and four more distant neighbours at distance sqrt(2).


2. Rotated square grid

rotated square grid
This is the plain square grid rotated 45 degrees. It has the same 4 near/4 far neighbour pattern. The Fuji "Super CCD" uses this sensor layout.


3. Quincunx grid

qunincunx grid
This pattern is produced by starting with the square grid and simply shifting every second row one half pixel to the left or right. You can think of it this way, or you can think of it as a rotated square grid that has been squeezed and stretched. The red lines show the latter interpretation; compare to the simple rotated square #2.

There are two nearest neighbours at a distance of 1, and four more neighbours at a distance of sqrt(5)/2. Also, note that the quincunx pattern is actually pretty close to hex grid #4.


4. Hexagonal grid 1

hexagonal grid 1
You can think of this pattern as starting with either #2 or #3 and adjusting the row/column spacing until all six neighbours are at the same distance from any given starting point. The red lines allow comparing the amount of stretch to #2 and #3. The green lines show the more conventional hexagonal tiling of the plane that generates this grid.


5. Hexagonal grid 2

hexagonal grid 2
You can think of this pattern as starting with #2 and stretching it in the other way, making it wider and shorter until you again get a hex grid, with six equidistant neighbours for every pixel. This is a somewhat remarkable result: no matter whether you squash or stretch the original rotated square grid, you can still get a hexagonal grid. The red lines show the square tiling after stretching; the green lines show the conventional hexagonal tiling.

Notes

Note that although #4 and #5 are both hexagonal grids with the same spacing, they are not the same grid. One has its rows of pixels at 30, 90, and 150 degrees, the other has them at 0, 60, and 120 degrees.

There's a deeper relationship between them too: (Warning: signal processing terminology ahead. Skip this if it doesn't make sense. This will not be on the midterm.)

If you sample a continuous image on a regular square grid of sample points, like pattern #1 above, then take the Fourier transform, the frequency-domain representation of the image has images of its spectrum replicated on a square grid as well - also pattern #1. In the frequency domain, you can think of the red squares as the copies of the spectrum, and the central square shows the un-aliased frequency response limit of the system. From this, we can see that the frequency limit for diagonal lines is 1.4 times higher than that for horizontal or vertical lines, since the corner of the square is 1.4 times further away from the centre than the middle of the side.

If you rotate the sampling grid, the Fourier transform rotates the same amount in the same direction. So #2 represents both the sampling pattern and its Fourier transform. Again, the red lines show the un-aliased frequency response limits. Now horizontal and vertical lines have a higher limit, but diagonal lines have a lower limit. This is what Fuji's Super CCD capitalizes on.

Now, if you take #2 and stretch it vertically and compress it horizontally to get #4, the Fourier transform does *not* follow. Whenever you change the vertical sample spacing in the spatial domain by a factor of K, the Fourier transform image spacing changes by a factor of 1/K (the reciprocal) in the frequency domain. So the Fourier transform is squashed vertically instead of stretched, and stretched horizontally instead of squashed.

In fact, the Fourier transform of #4 looks like #5, and the Fourier transform of #5 looks like #4. The two hex patterns are duals of each other. The Fourier transform of a hex sampling grid is also a hex grid, but it's the dual hex grid, not the identical hex grid. Neat, eh?

All of these diagrams were generated by a C program using OpenGL graphics (actually GLUT). The program is here if you want to compile it for yourself. The images on this page are just screen grabs of the windows drawn by the program.

Copyright David Martindale, April 2004