Channel editing

Here everybody can post his problems with PhotoLine
Benutzeravatar
Hoogo
Betatester
Beiträge: 4021
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: Channel editing

Beitrag von Hoogo »

The result with channel mixer.
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
cathodeRay
Mitglied
Beiträge: 151
Registriert: So 15 Nov 2015 12:37

Re: Channel editing

Beitrag von cathodeRay »

Hoogo - certainly good, though the car is perhaps a little desaturated? I've had another go with the Channel Mixer, and now have to contradict what I said earlier, it clearly doesn't output just greyscale +/- a tint. I'm not sure it's very intuitive: I have to visualize what I am doing with each adjustment eg your earlier B=72/33/-11 (all are %) means - I think - I am adding 72% and 33% of the R and G channel and subtracting 11% from the blue channel (I don't think you can in the real world have a negative RGB value (!) so these figures are relative adjustments, not absolute numbers). With three output channels and each one having three input channels it's all a bit mind-boggling. Interestingly, the dialog does have an eyedropper, and sampling discoloured parts of the image has promising effects until corrections of corrections start taking over... The Hue editor, though very powerful, seems more in the open/intuitive in its use.

Maxwell - meant to say it is the to-and-fro workflow you describe I was trying to avoid as well. Yes, we can copy a channel to layer, edit it there, or as a separate document, and then add it back to the channel - but it is a palaver! There are also things like alignment to address, and it loses the advantages of working in a stack where layer effects can be turned on and off at will.

FWIW and for anyone struggling with PL terminology, I think I've finally got my head round selections, lassos and masks: the lasso is a (vector) boundary between a selection and a mask, so all three are different 'versions' of the same thing, which means each can define the other two (which is why they can changed into each other so easily. If you know what the selection is, you know what the boundary (lasso) and so what the mask is, and equally all the other ways. In practical terms imagine an oval selection in the middle of an image. That's the selection. It's outer boundary is the lasso, and everything outside is the mask. There all there, all of the time (because once you know one of them, you know the other two), but 'focus' (and visibility, but that's not the same thing - 'focus' is more where you are looking) can be turned 'on and off'. So if you convert a lasso to a mask, you are turning off the lasso focus and turning on the mask focus - and so on. Hope that doesn't make it seem even more complicated!
Benutzeravatar
Hoogo
Betatester
Beiträge: 4021
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: Channel editing

Beitrag von Hoogo »

maxwell hat geschrieben:...but often I cannot obtain the wanted result in another way. E.g. how can I scale a channel and subtract it from a different channel (blend modes), with standard PL tools.
With the channel mixer you can add channels to, subtract channels from each other, and you can multiply each channel with a constant value. When you create the channel mixer as a working layer, you can use the blend modes of that layer. But sometimes it's a bit difficult to affect only one channel. "Darken" or "lighten" can easily be used, simply leave unwanted channels unchanged. "Multiply" needs 0/0/0, constant 100% to leave a channel unchanged, "screen" needs everything zero. Some more blend modes have a neutral color, didn't think about it yet, I had no good usage for it.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
Benutzeravatar
Hoogo
Betatester
Beiträge: 4021
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: Channel editing

Beitrag von Hoogo »

cathodeRay hat geschrieben:Hoogo - certainly good, though the car is perhaps a little desaturated?
You can turn the patch on and off and on and off and look at the parts near the stains. The mask was really rough, if you see no blinking, then the colors are good enough.
cathodeRay hat geschrieben:I've had another go with the Channel Mixer, and now have to contradict what I said earlier, it clearly doesn't output just greyscale +/- a tint. I'm not sure it's very intuitive: I have to visualize what I am doing with each adjustment eg your earlier B=72/33/-11 (all are %) means - I think - I am adding 72% and 33% of the R and G channel and subtracting 11% from the blue channel (I don't think you can in the real world have a negative RGB value (!) so these figures are relative adjustments, not absolute numbers). With three output channels and each one having three input channels it's all a bit mind-boggling.
Not sure if I understand it right.
Take the original R channel and multiply with 72%. So far the intermediate result is easy to imagine, it's a darkened red channel. Then add green channel multiplied with 33%. The intermediate result is now a mix with a little stain from the green channel. Finally a little blue was subtracted, it's meant to be a counterweight against the little stain from green. The result is the new blue, and it should look at least a little like the old blue.

I've chosen the values mostly by feel, I guess there could be better values for the mixer. I think I said more about the ideas in Ken's thread.

What I found useful to understand the channel mixer:
-Totally ignore that there are 3 channels of color. Set blue to Zero and ignore it everywhere, imagine a being with only 2 different receptors in the genes, red and green. All color picking, sliders and mathematics are so much easier to imagine when they are 2D instead of 3D.
-Make a test picture with all colors in this RG-world, 2 gradients, one from black to green, the other 90° from black to red. See how the mixer pushes and twists this color space.
-If you remember a little vector calculations from school, then you can also treat the mixer as a converter from one system of coordinates to another.
-The color cube plugin is really nice to imagine colors in space. It helps getting an idea of what happens when you set a channel to zero, replace it by another,mix channels...
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
bkh
Betatester
Beiträge: 3674
Registriert: Do 26 Nov 2009 22:59

Re: Channel editing

Beitrag von bkh »

cathodeRay hat geschrieben:Burkhard - please don't think I'm being critical, I'm not, I'm just reporting on (my) expectations (working on only the blue channel ie it alone is active/selected will affect only the blue channel) and my observations (that a change on only the blue channel does alter the other channels).
As we agreed above, selecting the blue channel (in the Channels panel) only affects viewing, not editing. You'll have to select the blue channel in the layer tools (not possible for all tools) to restrict editing to that channel. (Try it yourself: fill an image with black, select the blue channel and paint with white: you'll get white when turning all channels back on, not blue.)

Cheers

Burkhard.
Benutzeravatar
Hoogo
Betatester
Beiträge: 4021
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: Channel editing

Beitrag von Hoogo »

bkh hat geschrieben:As we agreed above, selecting the blue channel (in the Channels panel) only affects viewing, not editing.
Depends on where you click and what kind of layer is currently active. Clicking the eye symbol only affects the visibility of a channel. But if your layer is RGB and you click on the thumbnail or the text, then the editing of layers is affected.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
bkh
Betatester
Beiträge: 3674
Registriert: Do 26 Nov 2009 22:59

Re: Channel editing

Beitrag von bkh »

cathodeRay hat geschrieben:I have to visualize what I am doing with each adjustment eg your earlier B=72/33/-11 (all are %) means - I think - I am adding 72% and 33% of the R and G channel and subtracting 11% from the blue channel (I don't think you can in the real world have a negative RGB value (!) so these figures are relative adjustments, not absolute numbers).
The values simply mean that you compute the new B value by adding 72% of the old R, 33% of the old G and subtracting 11% of the old B. So if the old colour was (50,99,100), then you'll get a new B of 36 + 33 - 11 = 58. If you work in 8 or 16 bit modes, values below 0 get clipped to 0, and values above 255 resp. 65535 get clipped to that value. (Btw., visible colours outside a given RGB colour space can be represented by negative values.)

Cheers

Burkhard.
bkh
Betatester
Beiträge: 3674
Registriert: Do 26 Nov 2009 22:59

Re: Channel editing

Beitrag von bkh »

Hoogo hat geschrieben:
bkh hat geschrieben:As we agreed above, selecting the blue channel (in the Channels panel) only affects viewing, not editing.
Depends on where you click and what kind of layer is currently active. Clicking the eye symbol only affects the visibility of a channel. But if your layer is RGB and you click on the thumbnail or the text, then the editing of layers is affected.
You're right, of course. Completely forgot about that option. However, if the tool/filter does not support RGB channels (repair brush, Remove Objects brush) or you choose a different mode (Lab/HIS), the other channels will still be affected.

In any case, making a channel invisible does not protect it from being edited.

Cheers

Burkhard.
Benutzeravatar
photoken
Mitglied
Beiträge: 2162
Registriert: Sa 28 Sep 2013 01:25

Re: Channel editing

Beitrag von photoken »

cathodeRay hat geschrieben: FWIW and for anyone struggling with PL terminology, I think I've finally got my head round selections, lassos and masks: the lasso is a (vector) boundary between a selection and a mask, so all three are different 'versions' of the same thing, which means each can define the other two (which is why they can changed into each other so easily.
Not quite right.

In other image editors, "selection" refers to both the marquee and the content of the marquee. This is confusing, but we're all used to it. PL makes a precise distinction between "Mask", "Lasso (the marquee)", and "Selection":
  • The "Mask" is a grayscale image, ranging from black to white and having intermediate gray values, that defines the image area being targetted.
  • The "Lasso" (the marquee) is a vector representation of the Mask, the marquee line being the points of 50% gray between the black and the white areas of the Mask.
  • The "Selection" is the image content within the Lasso & Mask, varying in opacity according to the black, white, and gray values of the Mask.
In other words, when working in PL, one has to essentially forget about the word "selection" until you want to actually modify some image pixels.

BTW, you're right about the power of the Hue Editor -- extremely useful for many scenarios, and the ability to apply it non-destructively as an adjustment layer is awesome.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
cathodeRay
Mitglied
Beiträge: 151
Registriert: So 15 Nov 2015 12:37

Re: Channel editing

Beitrag von cathodeRay »

Thank you all for your input. For every light that goes on in my head, another (two?) seem(s) to go out! But I am sort of getting an overall picture.

I decided to go back to the beginning and see if I could work Hoogo's magic using his method but without borrowing/using his final RGB figures. Started OK, but hit the editing a mask roadblock again (simple pld of one background image, one adjustment layer with one child mask layer: can edit the mask but have to do it blind because can't see the background layer... At an earlier point I had an editable mask and a visible BG layer and so could see what I was doing, but have now lost that...).

cathodeRay
cathodeRay
Mitglied
Beiträge: 151
Registriert: So 15 Nov 2015 12:37

Re: Channel editing

Beitrag von cathodeRay »

OK I think I've got my head round how the Channel Mixer negative numbers work. I had been thinking that -10% was a multiplier (so the output had to be a negative number eg start with 50, -10% = -5, but the operation is actually a subtraction so it's take 10% off the original value so starting with 50, 10% = 5, so -10% = 45. Phew! (Unless I've still got it wrong). So, if an original pixel RGB values were say 30,60,110 and I dial in for say the blue channel 50%/33.3%/-10% the blue channel now becomes (50% of 30) + (33.3% of 60) - (10% of 110) = 15 + 20 - 11 = 24.

Having further reviewed Hoogo's excellent result, where I suspect many years of expert intuition came into play, I tried to find a way of guiding novices like me into which way to dial the magic numbers into the Channel Mixer to get the desired result.

I started, as I did before, by looking at the individual channels and as expected from the overall image the blue channel is the most damaged. Then, having put in place an appropriate mask (more on that later):

1. Go into the Channel Mixer, select the most affected channel output (in this case blue) and wind back the default blue input from 100% to 0%. The the blues go yellow, as expected from colour theory (removing blue = adding yellow). A too blue pixel that was 39/58/101 becomes (as expected) 39/58/000, with the yellow coming from the red/green mix.

2. Removing all the blue has gone to far: we need to add back some blue. Now here' the possibly interesting thing: since the output is a number between 0-255, it doesn't actually matter how we get there (I'm not sure about this, but empirically it does seem to be the case). So lets start by adding say 75% red. The yellow cast reduces considerably, and the pixel now shows 39/58/29 (and 29 is 75% of 39).

3. Let's reduce the yellow even more: this time we add 30% from the green channel: the yellow gets even less, and the pixel is now 39/58/46.

4. Now let's try getting the same result a different way. Put the green back to 0%, and make the the red input a bit more, until the yellow looks all but gone, and the pixel is again at 39/58/46. The red input is now at 119% (and the others both at 0%).

5. Now try doing the same thing with just the blue channel. After all, it is just about numbers, isn't it? Set the red and green channels to 0% and increase the blue channel input from 0% until the yellow all but disappears and the pixel is 39/58/29 - but that doesn't work, because other less blue pixels become too yellow. The lesson here is you need to add data from the other channels, not just remove blue data.

6. Blue channel inputs of 119/0/0% and 75/30/0% are similar in effect, but the all red based input does introduce a reddish tint, so moderation in all things: let's go back to 75/30/0% and tweak those numbers backwards and forwards a bit. The optimal settings by eye here are 70/60/000. I've deliberately avoided going into negative territory. We're nine tenths of the way there: the blue damage has gone, but there is a bit of unwanted yellowness.

7. Adding back some blue can help a bit. At 0% blue, there is a slight yellow effect, at 20% blue there is too much blue, but at 10% blue we are nine and a half tenths of the way there. So far, all our moves have followed a logical pattern: The damage was too much blue, so we removed blue, added some red and green data to compensate for the missing blue data, and then added back a touch of blue as at that point the result was a little too yellow. We now have the blue channel inputs as 70/60/10. 60/70/10 is very similar. The exact split between the channels probably isn't critical. The broad brush picture is remove the damage colour completely (set to 0%), add back data from the other two channels in varying proportions and optionally tweak the damaged channel by adding back a small amount of that channel.

8. At this point the repair is almost if not actually 'good enough'. Any further tweaking however is going to have to happen in another output channel, because we have already optimised the blue output channel. But which channel? There are both green-yellow tints and magenta tints!

9. At this point I did a Merged Copy > Paste as Layer and then did Blur > Calculate Average on that layer to see what is anything that told me. Visually not a lot, but in the pixel samples the green was a bit higher than the red, so as a starting point let's try tweaking the green channel. Or frankly, I could have chosen the red channel, because it was a bit lower. It is that scientific... Another reason for choosing the green channel might be that, in the channel list, it appears to have the best tonal range. What we do need to remember, though, is that in the green output channel, moving any slider to the right will add green, and moving any slider to the left will add magenta, and in the red channel right means more red, left means more cyan. In each case, amount (%) is 'factored' by the underlying amount in that channel, so if say the blue channel has twice as much as the red channel, then 10% of the blue channel will have twice the effect of 10% of the red channel.

10. I deleted the Blur layer and went back to the Channel Mixer layer and selected the green output channel. Hoogo's magic numbers here were 45/95/-30 but these seem extreme and where did they come from so I tried moving each channel input slider individually a bit to the left and right and watched the result. I started with the blue channel, because it was the 'offending' channel, and found that -10% (yes, I did have to go over to the dark side) was an overall improvement, but at the cost of some areas becoming more magenta - so either the red or green channel input needs to be increased. In practice, there was very little difference between adding either 15% red or 15% green (so the green slider went from 100% to115%) of for that matter 7.5% of each so, to keep things simple, I went with add 15% red, so the final green channel input was 15/100/-10. At this point, my image was very similar to Hoogo's final image, but I got there through a set of (quasi-?) logical, and so hopefully transferable to other situations, steps. For what it's worth, I think Hoogo's version appears very slightly desaturated in the car, but the sky is perfect, mine perhaps a bit too saturated in the car and the sky still has a very slight tint, but both I suggest are definitely 'good enough'. The law of diminishing returns applies here. Original in the middle, Hoogo's repair on the left, mine on the right:
Blue Damage Repairs.jpg
11. All that remains to add is that if one mask/Channel Mixer adjustment layer works for part of the damaged area but throws others out, then there is always the option to mask out the untoward area and add a new mask/Channel Mixer adjustment layer to target and correct that area, as indeed Hoogo did with the beach.

cathodeRay
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Benutzeravatar
Hoogo
Betatester
Beiträge: 4021
Registriert: So 03 Jul 2005 13:35
Wohnort: Mülheim/Ruhr

Re: Channel editing

Beitrag von Hoogo »

Yes, you git the numbers right, and it seems you also have the feeling for the sliders now.

Not sure what I mentioned or described in the other thread, so some more thoughts here.

-Imagine only the blue channel would be corrupted. Then there would be 2 pretty channels to replace it, but which one would fit better? The color wheel comes handy here.
If the good picture would be gray, then obviously all 3 channels are more or less equal, and also equally useful for replacement.
If the good picture would be blue, then red and green would be quite similar, but both darker than the blue channel.
If the good picture would be cyan, then blue and green would be quite similar, red would be darker, green should be a nice replacement for blue.
Your picture was more blue, with a little red/yellow on the beach. For the blue parts red and green would be equally good, for the beach green would fit better to the blue channel.

-Green had a little stain, blue had a bigger stain, but the stain was of equal color. So I guessed that I could create a clean channel by taking green and removing blue. Having "X*good + Y*bad" and subtracting "X*good + Z*verybad" should leave at least a little good. I did that with the channel mixer with grey output, starting with 0/100/0, and I moved the blue slider to the left until the stain was gone. That gave me the proportions of green and blue that I should use in all other tries later. But in the end it took just 5 minutes to forget about that proportions, for the result I was using the sliders freely again.

-I'm not sure if that green minus blue-channel has a meaning, something like a color. Maybe adding this channel is like adding green-yellow, but after all it is a channel that can add some variation. If you replace a channel completely by the others, the color cube plugin will show a plane in the cube.

-The replacing started with an adjustment layer channel mixer, blend mode "difference", and I viewed only the blue channel for the whole picture. A perfect replacement would result in a black picture, the available replacement should at least be as dark as possible for the unstained parts of the picture. I concentrated on the car and the water.
----------------
Herr Doktor, ich bin mir ganz sicher, ich habe Atom! /Doctor, doctor, I'm sure, I've got atoms!
cathodeRay
Mitglied
Beiträge: 151
Registriert: So 15 Nov 2015 12:37

Re: Channel editing

Beitrag von cathodeRay »

Hoogo - thanks for the further explanation of how to work the Channel Mixer. I still think there is some voodoo involved, especially in the negative percentages/subtracting less than zero etc. My own experiments (easily repeated by anyone who wants to do so) is that if you create a new document with a R/G/B background of 100/100/100 and add fixed colour sampler (to monitor the RGB values) and add a Channel Mixer adjustment layer and take the blue input down towards zero with the blue channel as output the pixel blue value behaves as expected down to zero (eg at 50% blue, the blue pixel value is 50). At zero percent, the pixel blue value is zero. Go into negative territory, and it stays at zero, ie it is being 'clipped', because you can't have a negative pixel value. Nor (obviously) does the colour visible on screen change. So I am still not sure how the negative numbers work their voodoo/magic!

That said, I have now used a similar but more sophisticated mask then adjust channels layer method on another damaged image, this time with 'measles' spots (lots of orange brown speckles). This is a approx 50 year old slide, film type unknown (the slide mount is a generic one with no brand name). It's possible the film is Kodachrome. The method I followed for anyone faced with similar damage draws heavily on Ctein's techniques (see here) and is as follows:

1. Create a 'measles mask'. Inspect the RGB channels and determine which channel(s) show the measles (as paler) most clearly. Use the Channel Mixer with greyscale output to create a greyscale in which the spots stand out (as paler) as much as possible.

2. Exaggerate the spots with a curves adjustment to ramp up the contrast. If necessary, paint in black over other pale areas (skin tones for example) to protect them (measles spots obviously won't be cleaned in these areas but the can be hand spotted later as required. This also means of course that if most of the image is skin toned then this technique isn't going to be much help, but of landscapes/buildings etc it does work).

3. Copy the tweaked measles mask to a new layer and hide the layers you used to make the measles mask (alternatively, these layers could be grouped and used as a group in the next step)

3. Add a Curves Adjustment Layer, then add the measles mask/measles mask group as a mask to that layer, thus limiting this Curves adjustment to the measles spots. Because the mask was made from a channel mixed adjustment layer, it has nice smooth transitions from the darker masked areas into the pale, now almost white, unmasked measles spots.

4. Now tweak the R/G/B channel curves. I have to admit the voodoo failed me here and I borrowed heavily from Ctein's advice, which was "The red curve increases the amount of cyan in the measles, while the blue curve reduces the amount of yellow." The red curve is slightly below neutral (the 45 degree line), as in removing red adds cyan, and the blue curve is slightly above neutral, as in adding blue removes yellow. It has to be said there is a lot of tweaking by eye at this stage. The only thing I couldn't get rid of was a localised yellow streak in one area (fixed later with the patch tool).

5. At this point, with the orange colour gone, the spots almost blended in with the texture of the image. It was almost 'good enough', but I figured that as I already had a 'measles mask' I might use it again with a Remove Dirt adjustment layer. Bingo! Measles spots gone, rest of image unaffected! Before and after snapshot below (the after image is before I applied the patch tool to the residual yellow towards the bottom of the image):
Measles_Correction.jpg
cathodeRay
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
bkh
Betatester
Beiträge: 3674
Registriert: Do 26 Nov 2009 22:59

Re: Channel editing

Beitrag von bkh »

cathodeRay hat geschrieben:Hoogo - thanks for the further explanation of how to work the Channel Mixer. I still think there is some voodoo involved, especially in the negative percentages/subtracting less than zero etc. My own experiments (easily repeated by anyone who wants to do so) is that if you create a new document with a R/G/B background of 100/100/100 and add fixed colour sampler (to monitor the RGB values) and add a Channel Mixer adjustment layer and take the blue input down towards zero with the blue channel as output the pixel blue value behaves as expected down to zero (eg at 50% blue, the blue pixel value is 50). At zero percent, the pixel blue value is zero. Go into negative territory, and it stays at zero, ie it is being 'clipped', because you can't have a negative pixel value. Nor (obviously) does the colour visible on screen change. So I am still not sure how the negative numbers work their voodoo/magic!
Yes, values below 0 or above 255 will be clipped (in 8 and 16 bit modes, 32 bit mode allows negative values and values above 1.0), but only in the final results.

Therefore, negative values in one channel only make sense if there is a positive value in one of the other channels, or if you use a positive offset. Just change your experiment a bit. For the blue output channel, set the green value to 100%. If you set the blue value to 100%, the resulting blue value will be 200, if you set it to 0%, it will be 100, and once you are down to -100%, it will be zero. Of course, negative values or values that sum up to more than 100% carry the risk that there will be clipping somewhere in the image, so one has to take a bit of care.

Cheers

Burkhard.
cathodeRay
Mitglied
Beiträge: 151
Registriert: So 15 Nov 2015 12:37

Re: Channel editing

Beitrag von cathodeRay »

Burkhard - ah, got it, I think! I was already clear about clipping to/at zero, but the way a negative percentage can come into play is if the output channel has already been input boosted by another channel, giving greater headroom before output zero is reached (but again when it is reached, +100% green, -100% blue in your example, it 'clips' to zero and won't go any lower).

cathodeRay