[Plugin] Mix3 - simple channel-mixing B&W converter

Postby ferdinand-paris on Wed Mar 14, 2012 6:53 am

I have just released a new plugin for both B5 & ASP that produces B&W images by mixing the RGB channels. It roughly preserves average luminosity (although 'roughly' is the operative term) by taking a weighted average of R,G,B with the slider values as weights. You can get Mix3 from my plugins page:

http://www.ferdinand-paris.com/bibble/

While you might be able to do something like this now by combining existing plugins, Mix3 is quick and simple if you just want to produce B&W by mixing RGB.

This plugin is something that I've been wanting to write for a long time. If I realised how simple it was, I would have done it a long time ago. The bit that held me back was working out how to preserve average luminosity. I mistakenly thought that I was going to have to measure the histogram before and after mixing and make an adjustment, which was complex. Finally it dawned on me that all I need to do is take a weighed average, rather than a simply average after weighting.

(Some old-timers will recall that the Andy plugin for Bibble4 had a channel mixer like this, which could be used as a simple B&W channel mixer by turning off the film and paper settings. The replacements for Andy - Andrea & Nostlagia also have such a mixer, but you can't turn off film and paper like you could in Bibble4. Eventually I realised how Sean did it, which was almost trivial in its simplicity.)

F_P
ferdinand-paris
 
Posts: 186
Joined: Sun Feb 05, 2012 4:37 am
operating_system: Windows XP Pro
System_Drive: C
32bit or 64bit: 32 Bit
motherboard: GA-X58A-UD3R
processor: 3.20 gigahertz Intel Core i7 960
ram: 4Gb
Video Card: NVIDIA GeForce 7300 GS
sound_card: Realtek High Definition Audio on-board
Hard_Drive_Capacity: 2500 Gb
Monitor/Display Make & Model: Eizo CG222W

Re: [Plugin] Mix3 - simple channel-mixing B&W converter

Postby AsterixEtObelix on Wed Mar 14, 2012 4:47 pm

Thanks Ferdinand

it works well and that s simple!
AsterixEtObelix
 
Posts: 38
Joined: Sat Jan 28, 2012 6:53 am
operating_system: Linux
System_Drive: N/A
motherboard: Debian squeeze 64
processor: Intel
ram: 8GB

Re: [Plugin] Mix3 - simple channel-mixing B&W converter

Postby Ianr on Wed Mar 14, 2012 6:22 pm

Thanks Ferdinand ... simple and elegant ... Nice. Ianr
Ianr
 
Posts: 25
Joined: Mon Jan 23, 2012 4:09 pm
operating_system: Linux
System_Drive: C
32bit or 64bit: 64 Bit
Monitor/Display Make & Model: Dell 30

Re: [Plugin] Mix3 - simple channel-mixing B&W converter

Postby gareth on Wed Mar 14, 2012 7:03 pm

Good idea but odd effects ? Doesnt seem to weight correctly on 2 channels?
Tried on gravestone with trees in background ( approximately white and green image)
-300/0/0 mostly black image
-300/-10/0 image comes back - white grave
-300/10/0 image 'solarised' with white for green area and very dark for white area.
If you can't reproduce, I'll send examples.
from the Bibble stable - mostly OLY+W8
gareth
 
Posts: 72
Joined: Tue Jan 17, 2012 4:48 pm
operating_system: Windows 8
System_Drive: C
32bit or 64bit: 64 Bit
processor: i5-3210M
ram: 6Gb
Video Card: Intel HD Graphics 4000
Hard_Drive_Capacity: a few TB
Monitor/Display Make & Model: Fujitsu Siemens L22W-5

Re: [Plugin] Mix3 - simple channel-mixing B&W converter

Postby ferdinand-paris on Thu Mar 15, 2012 4:24 am

gareth wrote:Good idea but odd effects ? Doesnt seem to weight correctly on 2 channels?
Tried on gravestone with trees in background ( approximately white and green image)
-300/0/0 mostly black image
-300/-10/0 image comes back - white grave
-300/10/0 image 'solarised' with white for green area and very dark for white area.

I wondered how long it would take for someone to discover this ... not long! This is a feature not a bug. As I said on my web page,

(But note: if you set each of the R,G,B sliders to -100 then the image will go black, as you've set each of the channels to zero. Any other combination of the sliders is ok, but some extreme negative settings can produce odd effects.)

I regard your examples as extreme. I'll explain the maths below. The easy way to prevent this kind of thing is to limit the sliders to the (-100, 100) range, but I chose not to do that so as not to limit the usefulness of the plugin. If you find values that produce strange effects ... then don't use them.

[basic maths]

Let's set a = 1 + (red slider /100) and the same for b and c. Then the formula being used by this plugin is rather simple, it's

B&W = (a*R + b*G + c*B) / (a + b + c)

Now the question is what happens when a+b+c = 0? The plugin tests for this and in this case divides by 1 rather than by zero and crashing the program. So if all sliders are -100, then a=b=c=0 and the formula is (0+0+0)/1 = 0 and you get all black in this special case. Your first case is equivalent (G + B - 2*R ) which will be dark rather than black. Your second case would be ( 1.1*G + B - 2*R) * 10. Such large changes will probably clip a lot of pixels. The third case is left as an exercise for the reader. If you want some really wild examples, try (-300,-1,0) and (300,1,0), which may have been what you really meant. The (-300,-1,0) case is (2*R - 0.99*G - B ) * 100 and you see that you get some very large changes when (a+b+c) is close to zero, which would no doubt lead to a lot of clipping.

[/basic maths]

I'm open to other ideas on how to handle the maths of extreme values, but I left the possibility of them open so that you could use more useful settings, like (200, 0, -200) for psuedo-IR.

F_P
ferdinand-paris
 
Posts: 186
Joined: Sun Feb 05, 2012 4:37 am
operating_system: Windows XP Pro
System_Drive: C
32bit or 64bit: 32 Bit
motherboard: GA-X58A-UD3R
processor: 3.20 gigahertz Intel Core i7 960
ram: 4Gb
Video Card: NVIDIA GeForce 7300 GS
sound_card: Realtek High Definition Audio on-board
Hard_Drive_Capacity: 2500 Gb
Monitor/Display Make & Model: Eizo CG222W

Re: [Plugin] Mix3 - simple channel-mixing B&W converter

Postby gareth on Thu Mar 15, 2012 6:17 pm

yes I had tried -300/1/0 etc as well ... but just reported the first case I found :-)
I missed the fact that weighting only works within part of the range of the sliders

thanks
Gareth
from the Bibble stable - mostly OLY+W8
gareth
 
Posts: 72
Joined: Tue Jan 17, 2012 4:48 pm
operating_system: Windows 8
System_Drive: C
32bit or 64bit: 64 Bit
processor: i5-3210M
ram: 6Gb
Video Card: Intel HD Graphics 4000
Hard_Drive_Capacity: a few TB
Monitor/Display Make & Model: Fujitsu Siemens L22W-5

Re: [Plugin] Mix3 - simple channel-mixing B&W converter

Postby ferdinand-paris on Thu Mar 15, 2012 6:38 pm

I hope my post didn't come across as too strong. Sorry if it did. But I wanted to head off further such discussions.

The sort and simple version is that if the sum of the sliders is close to -300, then (a+b+c) is close to zero, and so what you've set is that the average channel contribution to the B&W image is close to zero. In this range the effects are unpredictable. This is what I meant by extreme. Perhaps I should have been more clear. I might edit the page. You can also get strange effects if the sum of the sliders is sufficiently negative (below -300), but these effects vary and are not so bad as the close to zero case.

F_P
ferdinand-paris
 
Posts: 186
Joined: Sun Feb 05, 2012 4:37 am
operating_system: Windows XP Pro
System_Drive: C
32bit or 64bit: 32 Bit
motherboard: GA-X58A-UD3R
processor: 3.20 gigahertz Intel Core i7 960
ram: 4Gb
Video Card: NVIDIA GeForce 7300 GS
sound_card: Realtek High Definition Audio on-board
Hard_Drive_Capacity: 2500 Gb
Monitor/Display Make & Model: Eizo CG222W

Re: [Plugin] Mix3 - simple channel-mixing B&W converter

Postby gareth on Fri Mar 16, 2012 6:30 pm

no problem
from the Bibble stable - mostly OLY+W8
gareth
 
Posts: 72
Joined: Tue Jan 17, 2012 4:48 pm
operating_system: Windows 8
System_Drive: C
32bit or 64bit: 64 Bit
processor: i5-3210M
ram: 6Gb
Video Card: Intel HD Graphics 4000
Hard_Drive_Capacity: a few TB
Monitor/Display Make & Model: Fujitsu Siemens L22W-5


Return to AfterShot Pro Plugins

Who is online

Users browsing this forum: No registered users and 1 guest