Thursday, November 27, 2008

Off with his Head (2)

So we have our source images, and we have started building the target image. As promised, what we have to do next is take the head off the victim in a clean way that allows us to put it in the target.

Here's the victim, my friend Phil:



Today I'm working on my Mac laptop, and the screen shots are all cap'd from there. The tool we're going to use to get Phil's head out of the original picture is called the "scissors select" tool:

Now, we could use the magic wand (which is how we did this sort of thing elsewhere), or we could use the lasso tool, or the paths tool, or the foreground select tool, but I think the scissors tool actually gets the best results here. The scissors tool is a polygonal select tool which also senses the edge of the object you are trying to cut out, so in situations where the object to be cut out has a good contrast line from its bacjground, this tool can help out loads.

Let me show you what I mean. Phil, frankly, has great hair. To test out how this tool works, we're going to experiment fist on his hair to see what the tool does. First, select the tool, and click a starting point here:


I have enhanced the dot because Mac won't capture the cursor pointer, but now that you have selected one point on Phil's head, select more points around the top of his hair in a clock-wise fashion, until you get something like this:



Notice that I selected points relatively close to the edge of Phil's hair, and that I stopped where the part in his hair begins. But I didn't really "stop" -- as in, "closing my selection". I merely paused so you could keep up. Now, to show the power of the scissors select tool, move your cursor to the beginning point of your selection, close the selection area by connecting your last point to your first point, thus:



As soon as you click the final point, you'll get something like this:



The tool took it upon itself to find the high-contrast edges of the area you selected, and made the selection boundary the place where it understands one color ended and another began. I am sure that some of you long-time readers of this blog what to know why we didn't do this with the chess piece way back when, and I'll tell you why: the contrast between the eggshell-colored chess piece and the light squares on the board is not sharp enough to get a good cut without lots of selection points. Also, it was good for you to learn the magic wand tool first.

But that said, the advantage of the scissors select tool in this case is that we can get all the organic lines of Phil's head captured without too much fuss. As we select point in reasonable intervals along the border of his head, the tool will help a brother out by actually interpolating the curve between the points.

So go ahead: unselect our test, then start the selection process over again, this time tracing out something like this:



And then hit the "enter" or "return" on your keyboard to translate the pointed outline to an actual "selected" outline, thus:



And the real novices out there are thinking we are just done already, but no: the fluent users remember that the selection border needs to be feathered before we try to pull this face out of this picture, so let's feather the outline by 3 pixels to get a nice soft edge around Phil's face so we can get something approximating natural in the final result.



Next time we're going to take this selection and do almost all of the heavy lifting of this little stunt in one post. However, this prep work is pretty indispensable.

Stay tuned.