Controlling Depth of Field
When focusing in on a particular subject, the area of the image that is sharp is known as the focal plane. This runs parallel to the camera's sensor, so will ‘slice through' an image horizontally with standard lenses. The distance in front of and behind this focal plane itself is the area in focus, otherwise known as depth of field. The smaller that distance of focus is either side, the shallower the depth of field; the greater the distance the deeper it will be. This distance is intrinsically linked to the aperture, where the larger the opening (large aperture, e.g. f/2.8), the shallower the depth of field; as the opening closes progressively smaller (small aperture, e.g. f/22), the depth of field will become deeper.
When shooting with a camera assigned to automatic modes, the exposure will be a matched combination of aperture, shutter and ISO, without any direct consideration for the depth of field as such. Autofocus, too, will auto-select the focal plane based on a processing algorithm that detects where it believes your subject best is, though shooting in aperture priority mode does then allow you to control the depth of field. Only when manually selecting the focus point and thus focal plane will control be entirely in your hands, and this is the easiest way to gain comprehension of depth of field. Using a large aperture such as f/2.8, focus to the back of a subject and take a shot, then take a second shot focusing on the same subject's near-side with the same aperture. Compare the two images and you'll be able to see that shallow depth of field, but also the focal plane running through the images at different points, as per focus.
While the red flowers naturally stand out against the green background, a shallow depth of field helps emphasise this further.
Apart from aperture there are other factors that can affect the size of the depth of field. First and foremost an exposure needs to be correct, and sometimes the amount of light available won't lend itself to shooting with a tiny aperture, such as f/22. Though high ISO settings can help to overcome this issue, this also introduces more image noise which can be undesirable. Mount the camera to a tripod or support though and this problem can be overcome in some situations.
Then there's the distance between the subject and the camera, and the subject to the background for that matter, which also affects both the depth of field and the amount of blur that the unsharp area displays. This is exemplified most when long lenses shoot distant subjects with mid to wide open apertures, such as f/5.6, but display little discernible background detail.
Furthermore the type of lens, such as the addition of extension tubes to lenses, often employed for macro photography, will further narrow the depth of field. This can become very significant to the point that handheld shooting is almost impossible.
The depth of field achievable can also be affected by the size of the camera's sensor. If your camera has a small sensor, such as those found in compacts, then the depth of field will be greater and less shallow. However, the larger sensor found in a DSLR is capable of increasingly amplified shallow depth of field, assuming you have the appropriate lenses to match. As the sensor size continues to increase, so does this amplification of depth of field - a full-frame sensor such as those in the Nikon D700 or Canon EOS 5D Mk II is as big as current DSLR cameras get. Beyond this, medium format cameras with even bigger sensors exist, a common reason why leading portrait photographers will often choose to shoot with such models. Not only does the extra resolution provide significant detail, but the size of the sensor means really wide open apertures can provide a significantly shallow depth of field.