logo

Assignment, Week 13: Processing

Using curves to adjust exposure, contrast

For those who have done film, you know that taking the shot is just step 1 in making a photo. While most people would drop their rolls of film off at a lab and pick up the prints, similar to how digital photographers simply take the image file that comes out of their camera and starts posting it on the web, images from film or digital can be radically modified and made better by processing them yourself, either in the darkroom or with an image editing application.

We'll first focus on how to manipulate brightness with software. There are lots of ways to do this - most of you have probably seen a "brightness" slider in most basic image editing apps. One of the most versatile and powerful ways to adjust exposure is via a tool called "Curves". In Adobe Photoshop, which I'll be using for these examples, the tool can be found under Image->Adjustments->Curves. Here's the image we'll start out with:

When we open up the curves tool, we get a diagonal line - this is the "curve" that we will be manipulating. For those who have Adobe Photoshop CS3 or higher, you'll also see a graph behind it - this is the "histogram", which represents all of the pixels in the image and plots them according to their brightness (towards the right are the bright pixels, and towards the left are the dark - the number of pixels at each brightness is represented on the y-axis).

We can make adjustments to this curve, which will change the brightness of the image. By lifting the entire curve up, for example, the whole image gets brighter, much like if we just moved the brightness slider up on any other program.



Mouse over the image to see the changes

If we wanted to make the image darker, we'd just pull the curve downwards. Now observe what happens when we lift the curve up, but only on the rightmost portion. You can set points by simply clicking along the curve, and dragging the points to a new position.



When we lift the curve up, the image gets brighter, but only for those pixels that are in the region where the curve was lifted. Since our curve was raised mostly on the rightmost portion, the bright pixels became much brighter, but the pixels that were dark remained about the same. The same thing happens if we lift the curve up for only the leftmost portion (dark pixels):



This selective processing of images is where the power of curves come in. With a regular brightness slider, we only get two options: make the image darker, or make the image brighter. With curves however, we can adjust brightness levels individually for different portions of the image (based on original pixel brightness). Thus instead of results like this (everything brightened the same):

We can achieve images like this (only the dark pixels brightened):

Another powerful use of curves is enhancing contrast - making dark things darker and bright things brighter. We can achieve this by lifting the curve up on the right side (making bright pixels brighter), but pushing the curve down on the left side (making the dark pixels darker). This achieves a result like this:



Take care not to overdo this and change the curve too drastically, however, because this will clip the brights to pure white and the darks to pure black, destroying detail. You can tell if the curve is doing this by making sure the curve is not "flatlining" towards the right and left, like it's doing here:



Restoring dynamic range

One of the biggest problems with cameras is their lack of dynamic range capability - while we are able to perceive a large dynamic range with our own eyes, our cameras are simply incapable of capturing the same range of brightness. The resulting out-of-camera images, however, are not the upper limit of a camera's dynamic range capability - employing a number of post-processing techniques, details can be recovered from the shadow and highlight regions of the image, effectively expanding the visible dynamic range in the images.

As an example, we'll take this underexposed image:

This is an image that is mostly dominated by the "crushed shadows" mentioned last week - the dark pixels are so dark that they are visually indistinguishable and thus there is no semblance of detail at all - we can't make out any distinct features whatsoever in the bottom portion of the image, for example. However, even though the pixels are apparently indistinguishable, in reality they are very different and retain an incredible amount of detail. This is the same image after it has been brightened:

Even though the pixels all looked the same (indistinguishably dark) in the original image, brightening the image (in effect multiplying the differences between each pixel) reveals that the pixels are in fact distinguishable from one another, and possess a large amount of detail - we can see that the bottom half of the image retained detail that differentiates the subjects legs from the floor, and the floor from shards of glass on the right side, even though these differences were not visible in the original image. In fact, as long as the pixels are not clipped to pure black (0,0,0 for RGB values), detail still exists and can therefore be recovered.

The same is true for the highlight region. Take for example this image. Portions like the sky at the top or the subject's shirt exhibit "blown highlights" - areas that are so bright that no detail can be distinguished:

However, applying an exposure adjustment downward, we get this image, which reveals that in fact plenty of detail still exists in the sky and and the subject's shirt.

Now that we've established that detail exists in the shadow and highlight regions of images, how do we go about actually restoring this detail? The first method is simple exposure adjustment - if the image is too dark or bright, simply brighten or darken the entire image, respectively. There are several tools for exposure adjustment, the most common ones being:

Exposure adjustment tools are useful for correcting incorrect exposures - images that are simply too bright or dark, like the two examples above. The weakness of overall exposure adjustment is that they act over the entire image. Thus, they don't work well for images with high contrast. If you have a bright sky and a dark land in an image, for example, you couldn't use exposure adjustment to brighten the shadows without also brightening the highlights, which would destroy the detail in the highlights, and the same is true for trying to darken the highlight without darkening the ground. Curves has some control over what area of the image is affected, but to get the most out of shadow and highlight detail, true selective adjustment tools, like Photoshop's Shadows and Highlights or HDR blending, are needed.

As an example, we'll take this large dynamic range image - there are both very bright elements and very dark elements in the image.

Under normal exposure adjustment, we really wouldn't have much leeway in bringing out details in the shadow region without destroying all the detail in the highlight region, since overall exposure adjustments work on the entire image. By using a tool like Photoshop's Shadows and Highlights (Image->Adjustments->Shadows and Highlights, in Photoshop CS,CS2,CS3), however, we can selectively brighten only the dark pixels, leaving the bright pixels alone and preserving the detail in the highlight region.

And this is the result (mouseover to see the change):

Notice that the shadow region is brightened, but the area in the highlights remains unchanged. This is what makes the Shadows and Highlights tool so powerful - you can make strong adjustments to lift detail out of the shadow or highlight regions, without affecting the brightness/detail in other region of the image.

The Shadows and Highlights tool isn't perfect, however. Notice that although we were able to extract a lot of detail from the image, it does look slightly dull and unnatural. The main subject in the shadows-adjusted image doesn't look anywhere as good as the subject in an image adjusted with regular exposure adjustment:

Of course, what we lose with overall exposure adjustment is all the detail in the highlights (the windows are now completely white). So images look better processed with overall exposure adjustment, but they destroy detail on one end or the other. Shadows and Highlights can make adjustments without destroying detail, but the images can only be pushed so far before they start looking really dull and desaturated. Is there any way to get the best of both worlds? There is, and it's called High Dynamic Range (HDR) blending.

With HDR blending, we process multiple photos where we only concern ourselves with a certain brightness range in the image. For our example image, I'll process two images - one is the original with full detail in the highlight area without regard to how the shadow area looks, and the other is an exposure-brightened version with full detail in the shadow area, without regard to how the highlight area looks:

Original, correct exposure for highlight area

Edited, correct exposure for shadow area

We combine the two images in a process called HDR blending. A manual, old-fashioned way to do HDR blending is to simply stack one image on top of the other, and use a layer mask to show the highlight areas from the image correctly exposed for the highlights, and show the shadow areas from the image correctly exposed for the shadows. You can download this .psd Photoshop file (96MB!) showing how this is done. However, the manual method is tedious and requires a lot of fine-tuning, and today there are quite a few automated HDR blending program. In any case, here is the resulting image, which you can see, retains the most detail from the highlights and the shadows, and doesn't look nearly as dull as the version processed with Shadows and Highlights.

HDR blended image

There are other ways to restore dynamic range as well. One tip is to shoot in RAW mode - RAW stores a lot more tonal information than a simple JPEG file does, and therefore there is more shadow and especially highlight headroom where detail can be recovered. Using your camera's flash in daylight situations, in a technique called "fill flash", also serves to lessen dynamic range in the scene, thus allowing your camera to capture the detail from the entire range of brightness. See the slides on the Week 12 powerpoint file for examples of this.

Suggested programs:

GNU Image Manipulation Program (GIMP): Verstatile, free, open source image editing application. Not as powerful as Photoshop, and not as intuitive/easy to learn, but far more capable than most other free image editors
Windows download: http://gimp-win.sourceforge.net/stable.html
Mac download: http://darwingimp.sourceforge.net/download.html

Access curves by Colors->Curves

Adobe Photoshop
Access curves by Image->Adjustments->Curves
Access Shadows and Highlights by Image->Adjustments->Shadows and Highlights
Access HDR blending by opening files, File->Automate->Merge to HDR

Photomatix: Easy to use HDR blending program.
Windows/Mac download: http://www.hdrsoft.com/download.html

Color balance

An important but generally unknown characteristic of images is white balance - what exactly is a "neutral" color (greys, whites, blacks, etc), from which all the colors can be based upon. As we discussed before, the camera's sensor gets information about how much red, green, and blue there is in the picture, and from that, the camera derives the color. Normally, we would expect equal amounts of red, green, and blue to equal white light. However, what is actually "white" and what we perceive as "white" are two very differnet things. Take a typical indoor scene, for example:

This is what we see with our own eyes. However, the artificial lighting in the room is actually emitting light very heavily towards the red end of the spectrum - there is relatively little light in the blue spectrum coming out of the lamps at all. In reality, the lighting in the room looks like this:

Wow! This is quite a big difference, and nothing like what we see in real life! Yet if you actually measured the light in the room, this is what it would look like - lots and lots of red, and very little blue. The reason we see the image above is because our brains interpret the signals from our eyes and performs a sort of "white balance". We actually do perceive the "true" color image on the bottom, but upon receiving this information, our brains go: "Woah! This color is all wrong! It should look like this..." and reinterprets the lighting so we get the much more natural-looking scene above that we're accustomed to.

Cameras however, don't know anything about what colors "should be". They simply receive and interpret the light for what it actually is, which results in images like the 2nd one. As our minds re-interpret the light information to give us a more natural-looking color balance, cameras must do the same "white balancing" to produce colors that are in sync with the human interpretation of light - essentially, turning the second image into the first image.

Cameras do this via the "white balance", where either a neutral point (a white/grey/black point that should have no color saturation) is defined, or the camera is given a preset interpretation ("interpret this light as sunny/cloudy/fluorescent/3000K black body"). This is one of the most critical aspects of creating an image, as interpreting color the wrong way can have catastrophic results:


However, if you happened to not set your white balance correctly to begin with, there are ways to correct the white balance afterwards. The most rudimentary tool for this is Color Balance. In Photoshop you can find this under Image->Adjustment->Color Balance. In GIMP this is found under Colors->Color Balance.

This is the example original image, which as you can see has a very strong yellow tint, due to the nature of the fluorescent lights in the room:

Even though the color is extremely off, we can correct it by applying a color balancing - we want to offset the yellowish and reddish tones, and shift them towards more cyan and blue tones. This is the result we get:





Assignment Summary: