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.

Saturday, November 22, 2008

Off with his Head (1)

UPDATED: Hey -- before your read this tutorial, some of you will notice it has been changed from its original form where I put Phil's head on a mostly-nekked man's body to where I put Phil's head on the fully-clothed body of the wrestler Batista.

I changed this tutorial for one reason only: conscience. I thought it was somewhat funny to put Phil's head on the body-builder's body -- until someone linked to it randomly and it seemed pretty lewd to me. I apologize to Phil, who is above reproach as far as I'm concerned, his wife Darlene who has always been a friend to me and my family, and to any readers I offended.

Thanks for letting me get that off my, um, chest.

Alert Reader Yahooguntu asked the following:
Can you write a tutorial on how to take the head off someone in one picture and put it in place of someone else's head in another picture?
And of course the answer is "yes, I can". However, I will write it in blocks so that the various techniques needed to do this project can be understood discretely and people can learn at their own pace.

So what we're going to do is take this picture of the pro wrestler Batista:



And this picture of my friend Phil:



And we're going to create this irresistible hunk of man-flesh:



Now, for those who are self-starters, here are the steps we are going to follow, and if you can invent steps for yourself between posts here at GiMP University, go ahead and work at your own pace. The rest of you will have to wait for my amateur pace posts.

The steps:

[1] Create a working image for our project
[2] Remove the head from the victim
[3] Place the head in the target image -- including scaling, color correcting, and cleaning up
[4] cleaning up target image for final use

And to keep you from completely giving up on me, we'll do step 1 now as it is relatively easy. If you click on the image of the young body builder, it will open up in its own window, and from there you can download it to your desktop (same with the picture of Phil, fwiw).

Now, to keep us all on the same page, open that image in GiMP and do the following simple adjustments:

[a] duplicate the image using the "Image" menu, clicking "Image > Duplicate". Close the original in case you make a fatal error and have to start over.

[b] Double the size of your target image to 782 pixels wide, and allow GiMP to scale the height using the "Image > Scale Image ..." menu

[d] Use the Layers window and add a new layer to the target image. You can name it "new head" if you need that much help.

Just to answer your question before you ask it, we are blowing up this image to double the resolution to do our editing work so that when we have finished all the cutting and pasting, tiny flaws will get minimized when we blow the image back down to it's original size -- or smaller. That's a key tip which you should have seen elsewhere on this site: you want to do your editing work at double resolution so that you can worry about big stuff and not get consumed with pixel-level perfection.

More next time.