Ad
Ad
Ad
Pages: [1]   Bottom of Page
Print
Author Topic: Neutral RAW conversion to B&W  (Read 1773 times)
Guillermo Luijk
Sr. Member
****
Offline Offline

Posts: 1290



WWW
« on: November 02, 2008, 10:08:35 AM »
ReplyReply

Sometime ago I was thinking that some of the transformations applied over the RAW data in the development process were actually unnecessary and probably undesired if the goal is to get a monochrome (B&W) image. In particular I was thinking of two critical processes that can lead to information clipping both in the shadows and the highlights: white balance and conversion to the output colour profile. I find no reason to apply them before the final channel mix since both the WB and a matrix conversion to the output colour profile are just linear combinations of the three channels that for B&W purposes can be done after the development process.

So I have been trying with a neutral RAW development with 1.0 white balance multipliers (dcraw -r 1 1 1 1), and no conversion to any colour profile (dcraw -o 0). With the 3 RGB channels of the resulting image we can build a luminance through just one linear combination: Y=k1*R+k2*G+k3*B with k1+k2+k3=1

The chosing of the k1, k2, k3 parameters is the tricky part of the process since weighting each of the spectral bands captured by the sensor will affect deeply to the contrast and brightness of the output B&W image. That's why I wrote a short routine that creates images with 'all' possible combinations of R, G and B in the way:





Top left is a G=100%, top right is R=100% and bottom left is B=100%. The rest of samples are 'all' possible RGB mix combination. The transition is smooth enough to find out the best possible mix by visual inspection and use it for the final image without trial-error tests.

Once this is done and just applying a 2.2 gamma the histogram will be very clean without any clipped values in 0 or saturation as long as any of the three weighted channels were not clipped in the RAW data, so texture can be always preserved without any need for recovery if any of the sensor channels managed to capture it.



If we want a more academically academic correct interpretation of the luminance of the scene, a particular set of weights should be calculated for each camera sensor which could be a good start point to consider other mixing weights.

The colour and final B&W images were like this (they are in a preliminary state since they were not procesed beyond a slight contrast curve that's why they look dull):




What do you think? do you think this way to proceed is conceptually valid?

IMO the profile conversion means that all three RGB channels get contaminated with information from the other two. To form a colour image this conversion is absolutely necessary to obtain a proper colour rendition, but for B&W output it reduces the mixing possibilities of the underlying hardware (i.e. the sensor) by clipping and/or mixing RGB values that remained isolated and unclipped in the RAW data. Also the white balance, although can be applied avoiding any clipping, is unnecesary in the RAW development stage if a B&W output is the goal.
« Last Edit: May 30, 2013, 06:35:20 PM by Guillermo Luijk » Logged

JimAscher
Sr. Member
****
Offline Offline

Posts: 335



WWW
« Reply #1 on: December 25, 2010, 05:57:53 PM »
ReplyReply

Guillermo: Did you ever follow up with this "short routine" and make it generally available and/or usable to forum members?  Regards, Jim
Logged

Jim Ascher

See my new SmugMug site:
http://jimascherphotos.smugmug.com/
Nick Rains
Sr. Member
****
Offline Offline

Posts: 704



WWW
« Reply #2 on: December 25, 2010, 10:06:13 PM »
ReplyReply

I have recently been doing a lot of mucking around with various RGB to BW conversions mostly using either selective colour adjustment layers or calculations between the red and green channels. It had not occurred to me to use the greyscale info direct from the sensor before any profile and white point assignment.

I think this idea has some serious promise, at least from a theoretical POV.

Obviously the final choice of the k values will be highly subjective but the purity of the data will remain as good as possible and this can only be a good thing.
Logged

Nick Rains
Australian Photographer
Leica Akademie Instructor
www.nickrains.com
hjulenissen
Sr. Member
****
Offline Offline

Posts: 1679


« Reply #3 on: December 26, 2010, 04:08:07 AM »
ReplyReply

White balance and color 3x3 are in themselves linear processes. They should not lead to unavoidable clipping unless the pipeline is integer. I have been looking at recreating some of the dcraw stages in matlab (double precision float), where one has great freedom.

What do you think about doing b&w-optimized debayer? For "grey" parts of the image, the "document" mode of dcraw should be able to provide plenty of acutance.

-h
Logged
t6b9p
Newbie
*
Offline Offline

Posts: 34


WWW
« Reply #4 on: December 26, 2010, 11:41:20 AM »
ReplyReply

Quote
What do you think about doing b&w-optimized debayer?

This is something I have consdered would be of value for B&W IR as well. Perhaps this is similar to the approach behind iRAW Mono by khromagery.com
Logged
Pages: [1]   Top of Page
Print
Jump to:  

Ad
Ad
Ad