Wednesday, April 11, 2012

Correcting Pinhole Camera Images

The pinhole camera images may contain more image content than the number of aperture sized pixels would indicate. If one has an array of numbers which represent a test object one can generate the equivalent of a pinhole image by summing over a test aperture. In the example below the x values represent the object and x' an image obtained by using a 2x2 aperture.


The calculations for a few of the image points, x'j,k, are shown. If rows and columns of buffer points with value zero are included about the test object points then only one object point contributes to the sum for each point in the first row of image points.


If we start out with a new array, x''j,k, in which the points are all zero we can substitute the sums over the aperture using the new array instead of the test object. Starting at the top left we can solve one step at a time for the unknown image points in the new array using values from the pinhole image.


We get back the original pattern in the test image by doing one row at a time from top to bottom. In each case the new point is just the difference between the corresponding point in the pinhole image and a sum over known values in the partially completed reconstructed image.

To illustrate the process for more complicated images a test object was generated which contained a disk 101 lines in diameter. The simulated pinhole image was generated using a circular aperture 21 lines in diameter. While scanning from left to right and top to bottom if a nonzero point was encountered in the pinhole image the unknown image point was taken to be the position of the point of the aperture which was closest to the center of the disk in the pinhole image.


The extracted image shows a disk of the same diameter as the original but it did not contain the small dark spot in the center of the original image and also contained a few errors near the edge of the disk. The errors may be due to the scanning process or to the use of rounded values in the pinhole image.

2 comments:

TCullen said...

Can one write a program that would correct a complex image like a pinhole photo?

Jim Bergquist said...

There may not be enough information for this simple method to work. One can use coded apertures which uses larger apertures but requires multiple grids and exposures plus some computation to produce an image.

(Sorry for the tardy response. I just noticed "comments" on the overview page.)