PDA

View Full Version : Tips on isolating Trees?


cameo
03-22-2005, 02:07 PM
Can anyone offer some tips on how to go about extracting trees from their original source to add to a new composite? Im trying to make a painting at the moment and the trees are causing a bit of a headache I'm either left with a halo of colour around the edges, angular/pixely edges or a skinnier, unattractive version of the original.

Does anyone have any good methods for doing this aside from painstakingly going round each individual leaf? Particularly when the background isnt a flat colour either and has clouds, varying tones in it etc

Cheers

rrische
03-22-2005, 02:35 PM
What software are you working in?

cameo
03-23-2005, 01:54 AM
Photoshop Rick.

Im not especially savvy with channels but I guess they could be useful for something like this?

rrische
03-23-2005, 09:13 AM
Oh, I thought you were compositing footage.

With trees that are against anything but a bald sky, I just
paint a mask by hand. It's slow and tedious, but when you're done,
you'll have a perfectly extracted element.

cameo
03-23-2005, 10:07 AM
Yea thats what I suspected, I guess it pays off in the end since you only have to do it the once. Was just hoping there might be some way to expediate the process!

NickJushchyshyn
03-26-2005, 07:44 PM
Do you happen to have an example source image to share?

Here's a tutorial that uses the blue channel for a fairly clean sky.
It generally works for busier backgrounds too. The trick is really finding the channel (or combination of channels) that extracts the contrast between the leaves and background.

This is a 33Meg Quicktime video tutorial:
http://www.jushhome.com/nick/tutorial/m ... ut_v01.mov (http://www.jushhome.com/nick/tutorial/mpo_treecut_v01.mov)

If you post an example image, maybe a few people could comment with specific ideas for your particular challenge.

Hope this helps.
Have fun.

cameo
03-27-2005, 05:50 AM
Thanks for the reply NickJushchyshyn. Downloading the file as we speak so I take a look at it. I'll try and find some free webspace I can use to post the picture of the tree as like you say, every case is different.

homer
03-27-2005, 07:21 AM
Great Video,
Thanks for creating and posting it

NickJushchyshyn
03-28-2005, 07:39 AM
Glad the video can be of some help.
How big is your image file?

I think this forum allows for you to make attachments as large as 2MB to your posts.

cameo
03-29-2005, 12:49 AM
Here are the trees that I have been trying to isolate. There are pesky clouds etc so it was a little troublesome. Looking at it again I think RRische is right with this one, hand painting the mask is the best way. There just seems to be so many little fiddly bits that I dont think it would be possible to get a good automated result. Can probably use your method as a starting point Nick so should save some time. Here is the image anyway;

I also have to fix the colour issues on the trunks as well, I might just clone here because I didnt like the results I was getting with the CC tools.

Incidentally the area I'm trying to isolate are the near trees and rocks that they sit on, all the background to be ditched.

Any other thoughts having seen the image guys?

rrische
03-29-2005, 03:12 AM
Oi Vey! I see what you mean.

Whenever I need to find a matte for use in a photograph,
the first place I always look is in the original color channels.
In the case of something that is shot against a sky, the blue
channel almost always works.
I brought your picture into PS and looked at the channels. The
blue channel looks pretty good, the sky knocks out to almost
complete white.
I duplicated the channel (leave the originals alone!) and brought
up the levels dialog. I moved the middle slider to the right, increasing
the amount of black in the midtones, but leaving the black and white
point alone. This looked OK.
Because the BG sky is so bright, there is a lot of haloing and light
contamination on the itty bitty branches and twigs. So I brought the
far right slider in just a bit, to eat into those halo-y edges. If you look
at the histogram for this image, you see the enormous spike at the
white end of the scale. This is not good, and a sign that your photo
has exposure problems.
The other problem with this image is blue color contamination around the
tiny filigree branches caused by the BG sky color wrapping around small
dark branches, turning them dark blue.

The key to solving this issue, is to ask yourself "what kind of BG and I
going to be using this against?
Using the above process, I pulled the element and laid it against a white
BG and a black BG.

http://img194.exs.cx/img194/4628/treeresizematte5bm.jpg (http://www.imageshack.us)

How successful the result is can only really be judged by laying it into your
destination image and seeing how well it works. You can then judge if
you need to do extra work on the extraction, how much work, and if it's
even going to feasible.

Sometimes, you pick a photographic element that just can't be used.

rrische
03-29-2005, 03:24 AM
Oops. I left out an important step.
After I did the levels correction on the blue channel copy,
I INVERTED it so the tree turned white. Then I turned it
into a selection and pulled the tree.

NickJushchyshyn
03-29-2005, 03:44 AM
Absolutely need at least a little manual work on this one.
Do you happen to have a full-res version of the shot or is this it?

Here's what I came up with by playing around with it for about 5-7 minutes. (Sorry no time for a video at the moment. Maybe later tonight).

Started with a copy of the Blue channel like rrische, then used green channel to help cut away more. (Copied green, invert, made whites the selection, switched to the copy of blue, filled black. This way, anything that was bright green became black in the blue channel copy too)

Used a levels call to tighten up the blacks and whites (same as in the video).
Manual black brush over some of the highlights on the tree truncks.
Used the dodge tool in the lower left to burn out the remnants of the distant mountain (left a little light gray after teh levels call). The dodge tool is nice since, when set to "Highlights" mode, it will leave the dark pixels alone.

Finished by inverting the work on the blue channel copy. (makes sky black, solids white), copied this to the selection, and finished by using the selection as a mask for the forgound.
A bit of polishing at the end like in the video, where the stamp tool was used to fill in some extra leaves and wood at the edges of the mask.

Sorry this is typed out so quickly. Hopefully it's useful. Will try to make a more detailed video later tonight or tomorrow.

Have fun.

NickJushchyshyn
03-29-2005, 03:48 AM
Here's the mask.

cameo
03-29-2005, 04:19 AM
Wierdness, I can only see one image - from Ricks initial reply, I cant see your images Nick nor the ones that I posted originally! Is there some setting hidden to 'show all attachments'. I can follow with the text but still would be nice to see the attachments if you added them!

In answer to your question Nick, the image I posted is 50% of the original, which I can put up if you want? (Assuming it wont be lost in the ether like the others..!)

Edit: And naturally once I'd posted this message they all suddenly appeared again...sheez!!

cameo
03-29-2005, 04:38 AM
Rick/Nick

Thanks for the ideas.

Yea I was getting so far with a combination of channels and manual masking but the end result looked very scraggly - especially where the branches are very thin on the left hand side because in a lot of cases there was no longer enough of the photograph left to define the branch. There was also a distinctive halo left over because the sky was so bright. I'll be putting your tips to good use later on when I'll start from scratch with it.

I agree completely that its not idea material to be working with Rick, but I got it from the net so I'm prepared to accept any problems. Besides, with the help from this thread, if I can make it look halfway decent in the end then I think that it will have been a pretty good exercise. (using the rationale that better source images would make the process slightly easier)

NickJushchyshyn
03-29-2005, 04:55 AM
Glad to be of help.
Once the mask is created, the extra touches with the cloning tool (effectively under the mask) should help clear up the halo effect.

What are the color tones of the background you'll be inserting?

cameo
03-29-2005, 05:02 AM
It's like a hazy yellow sunset and green forest in the midground. I didnt actually try layering it onto that (mainly because its incomplete) but perhaps I should do that to see how noticable the halo is.

rrische
03-29-2005, 05:23 AM
Hey Nick,
Can you take your mask, extract the tree and lay it over a neutral
BG and post the result? I'd like to see how it worked.

Another way to use the mask (say on the problem areas like the
little spindly twigs or areas with color contamination) is to take
the mask you've created, get rid of the RGB pixels, and just paint
new twigs using the mask. This way, you can have a LOT of control
over the color you want. A good example of this is if you were putting
this tree over a sunset. You could then paint in browns, reds and oranges
that wrap the same way the blue is wrapping in the original photo.

By the way, this is an EXCELLENT way to use cloud alphas to paint
clouds in your shot.

NickJushchyshyn
03-29-2005, 06:33 AM
Great tip, Rick!
I'd never really considered applying this to cloud layers.
THANKS!

As far as painting over the RGBs, that's basically the intent of the stamp/clone tool work at the end of the process. This pulls color & patterns found in dense areas of the image and stamps them in over the pixels that are a mix of foreground and background in the original image.
This way, the mask takes over, mixing solid foreground with the new background, instead of comping old foreground mixed with old background over the new backdrop, which is the cause of halos.

I'm wrapped up for most of the rest of today, but will record a video based on the hi-res image and background tones. The video will be posted with the finished mask and finished comp for inspection. :)

Thanks again for the help Rick!

- Nick

03-29-2005, 06:38 AM
Is this kinda what you're looking for? I think the idea when using images found on the web is to use them as starting points for inspiration. You can't (shouldn't) use some one elses photo and try to make it fit into your image as is or that infringement.

I would say, get it close, don't sweat the small stuff and paint the additional details yourself to cover up some jaggies here and there. Perfect masks are an illusion. You know what you're trying to accomplish, but no one else has the ability to see what you envision, so you can actually get away with quite alot if your compositional and painting skills are up to snuff.

cameo
03-29-2005, 07:28 AM
Rick/dentsinger

It never dawned on me to create a mask from the photo to define the shape I (roughly) needed and then paint the colour detail in myself, thats a nice technique.

Presumably that wouldnt infringe on anything? I hadnt considered infringement issues actually because I thought that since Im not doing it commercially or for profit, and just as a hobbyist who's learning, it wouldnt be a big deal.

03-29-2005, 08:26 AM
Yeah, even if it's not going to be used for professional/commercial uses, it's just good practice. So additionally, you can look for trees or treelines, isolate a mask and then use the masks as part of your arsenal.

For that matter, study the tree and what it is that you like about it and practice painting that type of tree. Sizing your own trees down, even if gestural strokes were used can look quite realistic.

Block it all in with black and then using your eraser, choose a brush such as the leaf brush. Size it down, increase the scattering, decrease the count and go around the edges here and there to rough it up as well as letting light shine through the branches here and there.

DenB
10-03-2005, 10:45 AM
There are lots of isolated tree collections for sale as architectural illustrators have a neverending need for them. Sometimes it's easier to just paint your own, however.

Try one or two of the tutorials while you're at it (http://www.gardenhose.comurl). The Painter, PSP and PhotoPaint versions of the paints are included, but it's not that hard to make your own. You'll find some trees for download as well, old as they are.

Gimp, Dogwaffle, PhotoImpact have the necessary brush technology too. There's even a PS plug-in called Photospray that offers this brush. So, you're not limited to Corel products. The catch 22 is in making your own. It can be very time consuming. Still, when it works it often offers a fast, effective and distinctly original solution.

Here's one taken from photorealistic to more of a painted look using brushes and CS2 diffuse glow filter. The original is 3500 pix tall.

Dennis@DigArts
http://www.gardenhose.com

http://www.gardenhose.com/images/Painted-thin-fir.jpg

DenB
10-21-2005, 01:43 PM
Couldn't resist trying to paint the shrub/tree from above. It's a quickie and not very good compared to the work here, but it's not too far off for a 30 minute effort.

It's on a PSD layer (bigger) if someone actually wants to use it. There's a sycamore tree there as well. You have to click through the license, but it's fairly liberal. http://www.gardenhose.com/DVD-Sycamore.mv

DatD
http://www.gardenhose.com

http://www.gardenhose.com/groups/Shrub-Test.jpg