Building a Pinhole Camera: CS194-26 Fall 2018 Project 2

Hersh Sanghvi (cs194-26-add), Nikhil Uday Shinde (cs194-26-aea)

Project Outline

This project takes advantage of the pinhole effect, which states that a crisp image can be created when light is projected onto a screen through only a small hole. The notable result of this is that a lens is not required, and therefore the pinhole camera has infinite depth-of-field since it only uses simple geometric projection. However, images can still appear blurry if the pinhole size used is too large, since then too much light will enter through the pinhole and the projection will be diffuse. The formula for the optimal pinhole size is related to the distance of the screen from the pinhole and the wavelength of light used: r_opt = 1.9 * sqrt(550 nm * lambda). Since our box's focal length (lambda) is about 20cm, the optimal pinhole size should be about 0.6 - 0.7 mm.

A pinhole camera (from

In this assignment our goal was to build a pinhole camera out of a box.

Part 1: Building the Camera

Basic approach on small images
The Box, with pinholes
The Box, opened
The Box, front view
The camera for our camera

We used a shoebox for our camera, which we found had a good focal length. We cut two holes close together: one for the phone camera, and one for the pinhole itself. Because we were using a flat camera (LG G6), we found that mounting it properly to the box without getting a lot of light ingress was a challenge, so we took an old-school approach and covered the entire phone area with a felt cloth, which prevented light ingress. Since we could no longer touch the phone screen, we used a voice-activated shutter, which is a feature of the built-in camera app.

We used three sizes of pinholes: 0.7mm (calculated optimal), 3mm, and 5mm.

Captured Images

To capture images, we set our box down on a flat, stable surface, and used a long exposure on the phone to ensure adequate photos. The camera parameters were tuned after extensive experimentation. Without further ado, here are the results:

0.7mm ISO600 15s f1.8
0.7mm ISO600 15s f1.8
3.0mm ISO600 3.2s f1.8
3.0mm ISO600 3.2s f1.8
5.0mm ISO100 1.3s f1.8
5.0mm ISO100 1.3s f1.8
0.7mm ISO600 15s f1.8
3.0mm ISO200 3.2s f1.8
5.0mm ISO600 1.3s f1.8

The most apparent feature is that the 0.7mm photos look by far the best and most focused of the 3, which makes sense since we calculated this pinhole size to be the optimal for our box. The 3mm shows up as more blurry, while the 5mm is even more blurry, which is the expected result as the light is no longer crisply projected onto the backing screen. However, the exposures and ISOs could be lower with the 3mm and 5mm holes.

Extra Photos With 0.7mm Pinhole

All photos were taken with 15s exposure at 600 ISO.

California Hall
Moffitt Hall
A Fine Young Man
A Second Fine Young Man
View from Doe

Bells and Whistles 1: Light Painting

Though the 5mm pinhole is quite blurry, for low light situations such as light painting, it comes in very handy. For these, we took 30 second exposures at 2400 ISO to get good quality light paints.

*Any similarities with the Mercedes logo are entirely incidental and unintended pls don't sue us

Bells and Whistles 2: Pinhole Video!

This wasn't on the list, but we noticed it during taking pictures and had to try! While the 5.0mm pinhole is quite blurry, it lets in enough light for short enough exposures to take video!

Website template inspired by: