Building a Pinhole Camera

Student Names: Divyansh Agarwal, Akash Khosla

Course: CS 194-26 (Computational Photography)


A Camera Obscura, also known as a Pinhole Camera, is a box that captures an image using a small hole to let light reflected off a surface enter, and a screen to capture an inverted image of the surface in focus. It is the most primitive form of a camera, and provides insights into the basic principles behind how a camera captures light.

Design of Pinhole Camera

We made our Camera Obscura out of a shoebox. The shoe box was black in color (and the black shade of the shoebox was darker than the black shade of the black paper provided in class), except for the lid, so we only had to cover the lid of the shoebox in black paper - we used black duct tape as an adhesive to stick the black paper onto the interior. We stuck the lid onto the shoebox using black duct tape as a adhesive, to minimize the amount of light entering the shoebox from anywhere other than the pinhole.

We used a white paper as a screen. This white paper was stuck onto the interior of the side opposite to the pinhole, using glue. The distance between the pinhole and the screen was 12.5 cm. We computed the optimal pinhole size using the formula 1.9 * sqrt(550nm * 12.5cm), which gave us an optimal pinhole size of approximately 0.5 mm.

We poked 1 hole into three different cards. On each card, we had a pinhole of one of these three sizes: 0.5 mm, 1.0 mm, 1.5 mm respectively. We carved out a small rectangular piece on the box, and covered it with the card poked with the pinhole. The card was held in place by a 'pocket' we made on one of the sides of the box. This 'pocket' was made out of black paper, specifically for holding the card.

We used an iPhone 7 as the camera used to capture the image formed by the pinhole camera. The Procam app was used to capture the images on the iPhone with a long exposure setting. We made a hole for the camera close to the pinhole that was around the size of the camera aperture on the iPhone, and taped our iPhone onto the card such that the camera received light through the hole.

Sideview of Camera Snow

Frontview of Camera Forest

Interior of Camera Box and White Screen Snow

Cards with Pinholes and Holes for iPhone Camera Forest

Pocket for Card Forest


Smaller pinhole sizes required longer exposure times, whereas larger pinhole sizes needed shorter exposure times as more light entered through these pinholes than through the smaller pinholes. Specifically, we used an exposure time of 15 seconds for a 0.5 mm pinhole, 8 seconds for a 1.0 mm pinhole, and 4 seconds for a 1.5 mm pinhole - these exposure times were determined experimentally to give the best images for the corresponding pinhole sizes.

We had to rotate the images obtained from the iPhone camera 180 degrees and then flip then horizontally to get the images with the correct orientation as shown below.

0.5 mm Pinhole Snow

1.0 mm Pinhole Forest

1.5 mm Pinhole Mountains

0.5 mm Pinhole Snow

1.0 mm Pinhole Forest

1.5 mm Pinhole Mountains

For the first set of images, the image from the 1.0 mm pinhole seems to be the sharpest. The larger the pinhole size got, the better we were able to capture color. Since the 1.5 mm and 0.5 mm pinhole gave a blurrier image than the 1.0 mm pinhole, we decided a size of 1.0 mm was the best pinhole size for this image.

In the second set of images, we observe some noise for pinholes of size 0.5 mm and 1.0 mm, although the 1.0 mm image has less noise and provides a visible and sharp image of the building. Even though the image from the 1.5 mm pinhole has relatively little noise, the image from the 1.0 mm pinhole is sharper than the image provided by the 1.5 mm pinhole. The presence of noise for the images from smaller pinholes might be because of less light reflecting off the surface that we focused on, so the smaller pinholes weren't able to let in enough light to capture the colors of the object focused on clearly. In the previous image, there was a relatively large amount of light reflecting off the surface we focused on, so the 1.0 mm pinhole did not produce a noisy image.

Given the superior sharpness of images from the 1.0 mm pinhole camera in both images, while providing only small amounts of noise when enough light did not reflect off the surface focused on - the noise was small enough that the object was still conspicuous, we decided to use the 1.0 mm pinhole to capture additional images, to aim to get the sharpest images possible.

Additional Images

These images were taken using the 1.0 mm pinhole, determined to be the best pinhole size as above.

The fourth image we captured is shown below. For this image, we noticed that a 1.0 mm pinhole did not capture much light, and a 1.5 mm pinhole did much better at capturing the light - although the 1.0 mm pinhole does still seem to give a sharper image. This is probably because there is not much light reflecting off the object we were focusing on, and thus, with the 1.0 mm pinhole being the smaller one, it was not able to capture as much light as 1.5 mm pinhole.

Reference Image Snow

1.0 mm Pinhole Image Forest

1.5 mm Pinhole Image Mountains