Cameras, Explained

By and

What is a camera?

The camera has quickly become one of the most widely-used inventions of all time. In fact, despite being around for a couple hundred years there are more cameras used today than ever before.

iphone

Behold: the camera you take wherever you go.

But there is a lot more to a camera than just taking pressing a button to get a picture. Fancy DSLR cameras confront you with a huge array of options, most of them unintelligible to the average user. Although the terms sound confusing, they aren't too hard to grasp if you understand how cameras work. Let's explain how and why cameras are they way they are from first principles.

Zooming into the pinhole camera

In the following demo, we'll explain how the most basic camera works. Then, we'll learn about how cameras zoom in and out of a picture.

You can drag your mouse in the scene to rotate it. Try it out!

1/23

Here we have a little square that does something pretty simple.

When a blue ray of light hits it, it records blue.

If a red ray of light hits it, it records magenta (the combination of red and blue).

We call each of these squares a pixel. If we make a big grid out of these pixels, we have a full-blown image sensor...

...and in we can get the right light rays to hit the right spots on the sensor, we can get an image! This is basically how cameras record images.

Our first thought might be to just stick the sensor in front of something we want to take a picture of, like this block tree. This, however, won't work, because...

...each pixel on the sensor will get rays from the top of the tree...

...as well as the bottom.

Since each pixel gets all the rays from all parts of the tree, the final image will just be a single color. No good. (In reality, if you did this the image would be completely white since each pixel would be flooded with light from everywhere, not just the tree).

So how do we make an actual image on the sensor? We want each pixel on the sensor to receive light from a single spot on the image. One way of doing this is to cover up the sensor to only let light in through one spot. This is called a pinhole camera, and you can easily make one yourself using a shoebox if you'd like.

Each ray of light needs to go through the pinhole to get to the sensor. Here's a ray from the tree leaves...

And another.

Here's one from the trunk.

And another.

Lo and behold! We have an image. You'll notice that the image is upside down. This is a natural effect of using a pinhole camera. In fact, your eyes produce upside-down images too! It's just that your brain processes them right-side-up.

You might have noticed that the image cuts off big portions of the tree. Why is that the case?

Well, if we trace a ray from the top of the tree through the pinhole it completely misses the sensor.

Same goes for the bottom. Any ray that doesn't hit the sensor doesn't get recorded. How can we get the entire tree into the frame?

One easy way is to just increase the sensor size.

Now we're in business. Unfortunately, actual cameras can't adjust their sensor sizes on the fly.

But, we can do something else. Notice how the rays miss the sensor?

If we just move the sensor forward, now the rays hit the sensor.

Now we have the entire tree on the sensor! This is how we adjust zoom, or how much of the scene is in the camera image. This is also known as field-of-view (FOV). We can increase the FOV by increasing the sensor size or by moving the sensor closer to the pinhole.

Lens it up

In this demo, we'll explain why cameras use lenses. Then, we'll explain why using a lens often causes some parts of the image to be in focus while other parts aren't.

1/13

Let's begin by covering how lenses work. Depending on the type of lens, it will bend light in a certain way. We're going to ray trace some light from the top of the tree using this converging lens (converging because light rays come to a certain point instead of diverging). This will help us see where the image of tree will form.

First off, we draw a ray parallel to the horizontal axis going from the top of the tree to the lens.

This ray will be bent (refracted) and go through the black dot on the left and continue on to the sensor. This black dot is called the "focal point". It's where rays that travel parallel to the horizontal axis will get refracted to.

The next ray we draw is through the center of the lens. This one just goes straight through.

The last ray we draw goes through the focal point on the right...

...and because it did so, gets refracted parallel to the horizontal axis. You'll notice that all the rays converged to the same point and the sensor is at that location. In this case, the tree would be perfectly in focus!

That's not always going to be the case though. If the tree is further than where it was previously, the rays that hit the sensor aren't all converged to the same location on the sensor. This gives rise to what we call "depth of field". Depending on the setup, only certain depths in the scene will be in focus.

If we want this tree to be in focus, we simply move the sensor to where the rays have converged.

The size of the blur caused by the rays not converging is called the "Circle of Confusion". This is again caused by rays not being converged (thus causing confusion as to what the object really looks like). The less focused the rays are, the bigger the circle of confusion. So how do we lessen depth of field effects?

Let's use a smaller lens. This will decrease the "Aperture size". It's the diameter of the hole the light is allowed to go through. We can see that the spot size on the sensor got smaller.

If we decrease the lens size even further, we can see that the rays converge even more! Because light has a smaller area to enter, the rays are more likely to arrive at the same point.

To illustrate this, here's a ray that given a bigger lens could have gone on to hit the sensor. It doesn't do that because it misses the aperture. What happens when we go even smaller?

Well, if we go out to the size limit, we'll end up back with our friend: the pinhole camera. With pinhole cameras, everything in the scene is in focus and has no depth of field effects.

Now we know how a camera works! Here's just a small demo to show in a very basic way how the field of view, f-Stop (a bigger f-Stop is a smaller aperture!), and shutter speed (time during which the shutter stays open) affect how a picture would come out. Left click and drag rotates the top view, right click and drag pans the scene, and the sliders adjust parameters. Click here to give it a go!