Understanding Depth of Field in Digital Photography
Along with altering exposure on your dSLR, the aperture setting also affects depth of field, or the distance over which objects in the picture appear sharply focused. The figure below illustrates this issue. Notice that the background in the left image, captured at f/6, is much blurrier than its sibling, taken at f/22. The right image has a greater depth of field due to the higher f-stop.
You can use this aperture side effect to your creative advantage: For example, if you’re shooting a landscape and want to keep both near and distant objects as sharply focused as possible, you choose a high f-stop number. Or, if you’re shooting a portrait and want objects in the background to be softly focused, you choose a low f-stop number, which reduces depth of field.
One point to note, though: How much depth of field you get at any f-stop varies depending on the camera and the lens. Cameras that use small image sensors produce a greater depth of field than those with larger sensors. So, the background blurring you see at f/6 may be more or less than what you see in the example. Experiment to gauge depth-of-field possibilities with your camera and lens.
Adjusting the aperture setting is just one way to manipulate depth of field. The subject-to-camera distance, subject-to-background (or foreground) distance, and lens focal length all affect depth of field as well.