Isolate hair

Hier können Anwender über Ihre selbst erarbeiteteten Tricks berichten
Vivi_Ram
Mitglied
Posts: 208
Joined: Sat 28 Sep 2024 17:04

Re: Isolate hair

Post by Vivi_Ram »

[/quote]
Wow that's a very good cut out ... thanks. Put a gradient sky layer and it is perfect.
Sent PM
[/quote]

@lacogada. I've found one possible solution to this really tough one. It's a lot of details. @Herbert123's "calculation" approach is one. It might work. But my own approach is to slowly increase the contrast in a staggered way. Extract the highest-contrast channel to layer. Increase the contrast on that channel layer, and extract the highest contrast channel from THAT layer. And then build a mask. It took me some time to think through all the possibilities. But eventually I ended up with two layers. A face only mask layer. And a hair only mask layer. We can either apply this together to our original image, or merge the two, and apply as a single mask. :)
You do not have the required permissions to view the files attached to this post.
Vivi_Ram
Mitglied
Posts: 208
Joined: Sat 28 Sep 2024 17:04

Re: Isolate hair

Post by Vivi_Ram »

Girl mask-min.jpg
Weirdly, it won't attach!

Anyway, here it is. It is not perfect. But that's the best I could do for now. If I spend more time, I probably could get it done better. :)

@lacogada: This is probably one of the tougher ones I've worked one. But honestly, with practice, patience, time and lots of coffee, you can mask practically anything.

For now, I'll consider this challenge met. :mrgreen: :mrgreen: :mrgreen:
You do not have the required permissions to view the files attached to this post.
lacogada
Mitglied
Posts: 119
Joined: Tue 18 Aug 2020 03:07

Re: Isolate hair

Post by lacogada »

Thanks for all the info and files.

Lots for me to read and work with.
User avatar
Hoogo
Betatester
Posts: 4090
Joined: Sun 03 Jul 2005 13:35
Location: Deutschland

Re: Isolate hair

Post by Hoogo »

A bit how to use the channel mixer to create a mask, with some pictures of the color cube.

First I cropped most of the picture, so I only have to care for the interesting parts with the interesting colors.
Cut.jpg
Then I looked a while at the color cube. The bridge has sandy colors, sky is blue, both appear as separate clouds in the cube. And the clouds touch each other, where all the unsharp edges create mixed colors.

Here I viewed the cube exactly from one side. From this angle, colors are ordered by their green content from top to bottom, and by teir red content from left to right. All colors on the dotted line have the same amount of green. In a mask that was created from the green channel, they would all be mapped to the same position on the green arrow and become same grey in the mask. No way to tell bridge and sky apart anymore. Only some parts of the sky stand out and are clearly brighter than the bridge. These parts are just good for a mask, the rest not so much.
Green channel.png
Red channel is worst, any level of red can be sky or bridge, while blue is somewhat better than Green.

There are more ways to map the colors to one "channel" than just using RGB. Combining RGB with 33% each makes a simple brightness, same idea as using the L channel. If you check the channels manually, then it's worth a try.
All channels.jpg
But there is something like a best channel that can split bridge and sky and map them to different greys. That's what the last cube shows. Calculating that magic arrow that maps the objects best is not difficult:
- Take RGB out of the blue cloud
- Subtract RGB of the opposite sandy cloud
- And that are the numbers that the channel mixer needs. Maybe some additional factor...

But:
- Good blue and opposite sand are easy to tell from the color cube, but less easy from just the picture.
- Pick wrong blue and sand, and the result isn't that great anymore. Not as bad as the simple RGB channels, but the result will have overlapping in greys again.
- Dark blue is part of the bridge, not the sky. So even though it is a great picture for this method, the obvious choice for the 2 colors would not work.
You do not have the required permissions to view the files attached to this post.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
User avatar
Hoogo
Betatester
Posts: 4090
Joined: Sun 03 Jul 2005 13:35
Location: Deutschland

Re: Isolate hair

Post by Hoogo »

And another one: The "Restore background & Difference" method.

1) I added an adjustment layer "levels", so I can see all the gradients of the background very clearly. Such a layer on top is handy for many different tasks.
Girl1.jpg
2) Duplicated the layer and hid the bottom layer. will be needed later, but for now I only want to see one.

I want to select the whole woman and all hair. I've chosen a rather complicated way with a layer mask. In hindsight, a red, hard pen followed by "select color" would have been more easy. Not sure if some semi-transparent soft edges would bother me later, therefore the pen. Better safe than sorry.

I added a layer mask and used a black pen (not brush!) to delete all hair.
A few clicks to the layer mask button at the bottom of the layer list were needed.
- Apply layer mask to mask.
- Apply layer mask. But deleting it would be as good, it's all about the selection.
- Tool > Mask > Invert mask
Girl2.jpg
3) Selected a lasso tool to have "remove object". I used the "define image structure" at about 11 o'clock, pressed the "remove object" button, and the result was already really good!
Then I've thrown away the mask/selection and the "remove brush (S)" tool to fix the few bad locations (and missed hair).
Result was this: The background without the woman, with and without the levels adjustment.
Girl3.jpg
Girl4.jpg
4) Finally set the layer mode to "difference", made a merged copy, added levels...Very nice start for a mask. And something to think about: What do red hair and blue hair mean? Maybe that can be used for different masks, and different ways to apply the hair to a new background?
Girl5.jpg
You do not have the required permissions to view the files attached to this post.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!