Extracting a Plum Tree
You cannot always control the background conditions in your photographs, especially with large-scale objects. This tutorial shows how to extract a 30-foot high plum tree from its natural outdoor background. In some ways, this is more challenging than extracting a person, because of the translu-cency of the leaves; the intermingling of foreground and background in an outdoor setting make it more difficult. Let's dive in.
1. Open the file PlumTree.psd from the CD. Figure 4.15 shows the starting image; a version of this image is included in the color section.
2. Choose Filter > Extract or press Alt+Ctrl+X to open the Extract dialog box. The image in Figure 4.15 is mostly shades of green on screen; choosing a highlight color other than green is therefore appropriate. In the Tool Options group at the right, select Red as the Highlight color from the drop-down menu.
The original plum tree photo
The original plum tree photo
3. Drag the lower-right corner handle of the Extract dialog box and enlarge it to fill your screen. The size that it becomes depends on the resolution to which you have set your graphics card (see Chapter 2, "Working with Color").
Feel free to use the Zoom and Hand tools within the Extract dialog box at any time to navigate the image. These tools do not interfere with any of the other tools and work identically to the Zoom and Hand tools in the toolbox. The amount that you will have to navigate ultimately depends on the size you are able to make the dialog box; if you have less resolution, you will have to navigate more.
4. Start with a brush size of 35 (set in the Tool Options group) and use the Edge Highlighter tool (press B) to trace the outer boundary of the tree's leaves and branches. Do not worry about trying to trace interior areas of translucency yet. Also, do not use Smart Highlighting on the leaves and branches because it would be far too tedious to try to trace the edges of the myriad leaves. Instead, focus on quickly outlining the silhouette of the tree with a larger brush size first.
TIP In general, a smaller brush size is better when using the Edge Highlighter because it produces a smaller transition area between the object you are extracting and its background.
5. Check Smart Highlighting in the Tool Options group and proceed to trace the hard edges of the tree trunk itself. Intentionally draw a horizontal line at the bottom of the tree trunk where it meets the grass to create a complete highlight enclosure.
NOTE If you make any mistakes while painting with the Edge Highlighter, you have one undo (press Ctrl+Z) while in the Extract dialog box. You can also use the Eraser tool to get rid of stray highlighting; then you can go back and properly highlight the affected area.
6. Use the Fill tool (press G) and click inside the enclosure you highlighted in the previous two steps. Figure 4.16 shows the tree with proper highlight and fill. You'll find a version of this image in the color section.
There is a way to help smooth out irregularities in the highlighted areas you trace. The Textured Image feature blurs the boundary between the foreground object and its background; it is appropriate for wispy edges (such as hair) or edges with a mixing of opaque and translucent areas (such as leaves).
NOTE You can undo a preview in the Extract dialog box by pressing Ctrl+Z. This is helpful when you want to try a different smoothing setting and then preview again.
7. In the Extraction group, check Textured Image. Click the Smooth drop-down and increase its value to 33. Now that you have defined the edges (with highlight) and indicated what part of the image is the foreground object (with fill), you are ready to preview the result. Click the Preview button. Your computer may take a few seconds to process this request, and then a preview will appear as shown in Figure 4.17.
Extracting a tree with Highlight and Fill
A preview of the initial extraction
The initial preview is rough; parts of the background show through the tree itself. You can improve the extraction by working with the versatile Cleanup tool. When you use this tool "normally," it removes opacity from the pixels in the preview. Using it in combination with the Alt key works in reverse, adding back opacity from the background into the preview. Either way you use the Cleanup tool, it works cumulatively, so multiple passes subtract or add more pixels as you go.
NOTE The Cleanup tool does not function like an airbrush, so holding the mouse down for a period of time does not increase its effect. Slight movement of the mouse, however, produces cleanup.
This part of the extraction process is most like an art and probably will require some practice. The process is a bit like visual sculpture, as you work to liberate the object from a matrix of background pixels.
Try to avoid using a small brush size when cleaning up internal areas, or you will be able to perceive the round brush shape in the extracted image. Make several passes with the tool and build up changes slowly.
8. Select the Cleanup tool (press C) and use it to remove pixels that do not belong to the tree. Hold down the Alt key and use the Cleanup tool in reverse to add back pixels that are missing (see Figure 4.18).
NOTE You do not have to clean up the image perfectly at this stage. Aim to improve the rough extraction only. We'll use additional tools later to refine the image.
You can use the Edge Touchup tool following the Cleanup tool, but use Edge Touchup only along hard edges you want to sharpen. The trunk has edges that should be sharpened now.
Cleaning up the tree
Cleaning up the tree
9. Select the Edge Touchup tool (press T) and drag along the edges of the main trunk. The tree bark looks harder. Click OK to accept all the changes you have made up to this point, and close the Extract dialog box. Notice how the Background layer was automatically converted to Layer 0, which now contains pixels of the foreground object surrounded by transparency.
Now that you have completed the extraction, you can do several things to improve the image before it becomes part of your entourage. Whenever you are working on a layer with transparency (such as Layer 0), create a Backdrop layer to help you see the fringes of the object.
It is wise to view your prospective entourage against both black and white backdrops alternately as you are refining the extraction. Most images have bright or dark pixels that do not belong with the foreground object; these pixels are visible only against a contrasting backdrop.
10. Create a new layer (press Shift+Ctrl+N). Give the new layer the name Backdrop. Drag this layer below Layer 0 in the Layers palette. Reset the default colors (press D). Fill the Backdrop layer with the foreground color (press Alt+Backspace). Now the backdrop layer is black. Click Layer 0 to make this the current layer for editing.
The Magic Eraser is a tool that you must be careful using. Each time you click the Magic Eraser, you have the power to erase many similar pixels in the image to transparency. It is safer (and slower) to work in Contiguous mode, where the tool will affect only similar pixels that are connected to the point you click. If you do not use the Contiguous option, the Magic Eraser will work on all similar pixels in the image at once.
11. Choose the Magic Eraser tool from the toolbox; this is under the Eraser tool, and you can also access it by pressing Shift+E multiple times to cycle through the three types of Eraser tools in Photoshop. On the Options bar, choose a Tolerance of 15, check Anti-aliased, leave Contiguous and All Layers unchecked, and leave Opacity at 100%. Finally, press the Caps Lock key.
TIP Pressing the Caps Lock key activates the precise cursor, which appears as cross hairs centered on the tool's hot spot. The hot spot is where the tool takes effect in the image. Most tools have icons whose hot spots vary in position relative to the pointer.
Each time you click the Magic Eraser, you erase many pixels in the tree image. The Magic Eraser is sensitive to the exact pixel color you select. If you think too many pixels disappear when you use this tool, undo and try again. You can also adjust Tolerance to a lower value to affect fewer pixels.
12. Now that you have a black backdrop, white fringe areas will be evident around some of the leaves. Using the Magic Eraser with the precise cursor, carefully click a white pixel. All similar pixels are erased to transparency. Repeat this step until you are satisfied that the white fringe has disappeared, all the while being careful not to erase any important parts of the foliage (see Figure 4.19).
Before you are done with the Magic Eraser, take a look at the tree over a white backdrop because this will reveal the dark fringe in the tree image.
13. Select the Backdrop layer in the Layers palette. Press Ctrl+Backspace to fill the current layer with the background color. Now the Backdrop layer is white. Click Layer 0 to make this the current layer for editing.
The dark green pixels belong to some of the evergreen trees in the background of the original image (refer to the color section).
14. Using the Magic Eraser, reduce the Tolerance to 10 on the Options bar and then click a dark green part of the fringe. Undo, and try again if necessary. Repeat this step until you are satisfied that the dark fringe has disappeared, still being careful not to erase any important parts of the foliage. Figure 4.20 shows the result. Press the Caps Lock key to toggle off Precise Cursor mode.
Chances are, you erased a bit more than you wanted while using the Magic Eraser. One reason this may have happened is that the dark fringe is composed of dark green and brown pixels, which are similar to the plum tree's trunk and branches—therein lies the challenge. Fortunately, you can replace important parts of the tree that might have been wiped out by the Magic Eraser.
NOTE Extracting entourage often involves a give-and-take process whereby you ultimately coax the figure away from its background.