Coded Aperture Imaging

Mmm, gumballs...

This image was taken with a traditional camera and lens, but could just as easily been taken with a pinhole camera, in which the lens is replaced with a small hole. Pinhole cameras have a couple of advantages over lenses - they have infinite depth of field, and they don't suffer from chromatic aberration, which can be cured in a refractive system only by using a multiple element lens. Because they don't rely on refraction, pinhole cameras can be used to form images from X-ray and other high energy sources, which are normally difficult or impossible to focus.

The biggest problem with pinholes is that they are... pinholes. They let very little light through to the film or other detector. This problem can be overcome to some degree by making the hole larger, which unfortunately leads to a decrease in resolution. The smallest feature which can be resolved by a pinhole is approximately the same size as the pinhole itself. The larger the hole, the more blurred the image becomes. Using multiple, small pinholes might seem to offer a way around this problem, but this gives rise to a confusing montage of overlapping images. Nonetheless, if the pattern of holes is carefully chosen, it is possible to reconstruct the original image with a resolution equal to that of a single hole.

This pattern is a Modified Uniformly Redundant Array, or MURA. A MURA pattern can be used as the aperture of a pinhole camera, and consists of nearly 50% open space. In the case shown, the MURA is 211 elements on a side, which gives it a light gathering power ~22,000 times that of a single pinhole. A MURA is constructed on a square lattice whose side length p is prime; each element of the MURA, A i,j, where i and j run from 0 to p - 1, is:

where Cq = +1 if q is a quadratic residue modulo p, and -1 otherwise. C q is also known as the Jacobi symbol. If x2 mod p = q mod p, q is said to be a quadratic residue of p. The resulting array of 1's and 0's can be cyclically shifted to bring the upper left corner to the center of the array, resulting in the pattern shown, where white corresponds to 1 and black corresponds to 0.

In any case, if we use this MURA as the aperture of our camera, the original gumball scene produces an image which most would not consider to be a great improvement over that produced by a single pinhole. The multiple overlapping images generate what could graciously be called a huge mess.

There's hope, however...

This decoding pattern is based on the MURA above. Its elements, Gi,j, are constructed from the MURA's elements Ai,j and are equal to:

Each 0 in the MURA is replaced by a -1 in this pattern, with the exception of the upper left element, which is always 1. Again, the resulting pattern has been cyclically shifted to bring the upper left corner into the center, which shows the symmetry of the array.

If we now perform the correlation of the smeared image above with the decoding pattern, we can reconstruct the original scene with a resolution equal to the smallest element of the MURA, with a tremendous gain in light gathering power.
A couple of interesting points remain. First, actually building a pinhole camera using this technique is not straightforward. Because a tremendous amount of light comes through the aperture, exposure times become much shorter than with a single pinhole. The resulting image must then be digitized and fed to a computer for post processing; alignment of the image becomes a problem. Still, it might be worth making a transparency of the aperture shown above, and projecting its image through a tube onto a translucent screen, where it could be photographed directly. The ultimate camera would let the pattern from the aperture fall onto a CCD, which would digitize the image directly and pass it along to a microprocessor for the requisite mathematical treatment.

It is not clear whether such a camera would exhibit the infinite depth of field associated with single pinholes. Light reflecting from different points of an object close to the aperture would enter the mask at different angles, which would seem to necessitate a more complex decoding procedure. Still, we can speculate that the resulting pattern would carry enough information to reconstruct the depth information from the scene. This is an interesting problem which needs further exploration.

This page is based largely on the article New Family of Binary Arrays for Coded Aperture Imaging by Stephen R. Gottesman and E. E. Fenimore, from Applied Optics Vol. 28, No. 20, 15 October 1989. An excellent web site on the topic can be found at Coded Aperture Imaging in High-Energy Astronomy, which also has an extensive bibliography.

For those interested in generating their own matrices, the results given by the above algorithms for a 5 x 5 MURA and its decoding array are:

0 0 0 0 0
1 1 0 0 1
1 0 1 1 0
1 0 1 1 0
1 1 0 0 1

+ - - - -
+ + - - +
+ - + + -
+ - + + -
+ + - - +

The images presented here were constructed by convolving the original image with matrix representations of the apertures in Mathematica. The original color image was split into red, green and blue channels within Photoshop, and these monochrome images were saved in raw format. After processing, the resulting data files were read back into Photoshop and recombined into a color image. Mathematica performs Fast Fourier Transforms to aid in the convolution and correlation operations, and also has a function which returns the Jacobi symbol.

Building a real coded aperture camera is difficult. We have cheerfully assumed here that the detected scene ends abruptly at precisely the limit of the aperture's field of view. In real life, sources outside the field of view cause partial views of the aperture to fall on the detector or film, which adds noise and spurious images to the reconstructed product. Also, misalignment of the aperture and detector elements will cause further difficulties. Nevertheless, several such cameras have been built and used for X-ray and Gamma-ray observations aboard balloons and satellites.

Originally posted November 29, 1998.

I maintain links to all my pages with a single JavaScript program. If the links don't appear below, you either have JavaScript turned off or are using an older browser. In any case, you can always see a complete list of links on my Home Page. If you have questions or comments about this site, please send me an message.