PDA

View Full Version : grayscale images


jmamer
18th of September 2002 (Wed), 11:02
Hi All!
I'm interested in making some hi res gray scale images. I was wondering how gray scale images are best produced from the D60?

More specifically, it seems to me that when I ask my image processing software to produce a gray scale image from a 16-bit TIFF file, it's taking a color image that has been produced by interpolating pixel information (to produce colors) and then converting the color values into shades of gray. It would seem (at least to me) that a better way would be to take the RAW file and produce the gray scale image directly from the pixel data without color interpolation.

Is there a way to get "un-interpolated" gray scale? Are there interpolation algorithms that are specialized to gray scale imaging? Would going to such lengths materially improve image quality over simply converting a 16-bit TIFF file to gray scale?

Thanks
John

Roger_Cavanagh
18th of September 2002 (Wed), 12:46
John,

I see what you're driving at, but I would suspect that taking a brightness value from, say, a blue pixel would not necessarily give the appropriate gray scale value for whatever the interpolated colour was.

The more normal method of producing B&W images is to use th channel mixer. Fred Miranda has some inexensive Photoshop actions here http://www.fredmiranda.com/DBWpro/index.html.

Silver Oxide have some expensive ones here http://www.silveroxide.com/Index.htm.

Daan van Eijndhoven has some free stuff here http://www.digidaan.nl/. You have to search for this one. :)

There's a short tutorial here http://www.luminous-landscape.com/tutorials/b&w_better.shtml

Regards,

adamsmith
18th of September 2002 (Wed), 18:46
This is very interesting. I've always used Image->Mode->Grayscale and never really though much about what it did. But now that I've been experimenting with Image->Adjustments->Channel Mixer, I find that it is not possible to duplicate the results of Mode->grayscale using the channel mixer. It appears that Mode->Grayscale is anything but a linear combination of the channels. I get the impression that it's adjusting gamma of each channel prior to mixing, or something like this, and then the mixing is not evenly weighted.

For example, bring up Image->Adjustments->Channel Mixer and enter 33% each for Red, Green and Blue. The results will be poor, IMHO, and they are nothing like Mode->Grayscale's results. My Nikon 950, for example, has bad noise in the blue channel, and the 33/33/33 linear combination of channels makes that very evident. There is a lot more visible noise in the result, and practically none when Mode->Grayscale is used (it seems to give little weight to the blue channel).

Does anyone know the exact formula that Adobe's convert to grayscale uses?

-Adam

jmamer
18th of September 2002 (Wed), 19:53
Roger_Cavanagh wrote:
John,

I see what you're driving at, but I would suspect that taking a brightness value from, say, a blue pixel would not necessarily give the appropriate gray scale value for whatever the interpolated colour was.

The more normal method of producing B&W images is to use th channel mixer. Fred Miranda has some inexensive Photoshop actions here http://www.fredmiranda.com/DBWpro/index.html.

Silver Oxide have some expensive ones here http://www.silveroxide.com/Index.htm.

Daan van Eijndhoven has some free stuff here http://www.digidaan.nl/. You have to search for this one. :)

There's a short tutorial here http://www.luminous-landscape.com/tutorials/b&w_better.shtml

Regards,

Roger,
Thanks for the pointers. I agree that reading the intensities directly from the pixels is probably too crude. I was making the (naive) assumption that "shades of gray" amounted to different intensities of white light. In principle, it ought to be possible to take the intensity reading from a green pixel and figure out the corresponding intensity white light. Here I'm assuming that "white" is balanced for the particular light source. An alternative approach might be to just sample the green pixels, or just the red ones, etc. Again, I'm not advocating that any of these things would be reasonable to do, I'm mostly wondering how it's done.
I'll follow the pointers you listed, maybe I'll know more in a little while.

Thanks again
John

adamsmith
19th of September 2002 (Thu), 01:08
OK, I did a little research on this topic. Many pages I came across state that Photoshop's grayscale conversion can be approximated with the the Channel Mixer settings of R:30% G:59% B:11%, where these scale factors approximate human eye sensitivity to red, green and blue. I did some tests on "real world" photos, and the results are indeed quite close. But not that close:

http://www.airraidsirens.com/converttogray.jpg

Comparing histograms above you can see that, while it looks pretty close, this simple weighted average is not what Photoshop is doing in Mode->Grayscale conversion from RGB. Another conversion test I did of the 30/59/11 channels settings on more diagnostically useful images color gradients (rainbow colors faded to white and to black) showed me that the results with this method do not match the photoshop conversion over the full range of RGB shades.

So what is Mode->Grayscale doing? Something far more mathematically involved! A little experimentation, and I found that photoshop's grayscale conversion much more closely matches the Lightness component of an RGB->CIE L*a*b* conversion. The mathematics to this perceptual conversion involve some transforms to get 3 tristmulus values (XYZ of 1931 CIE XYZ color space) and then further non-linear scaling to correct for "logarithmic response of the eye" in attempt to "linearize the perception of color differences". If you're interesting in the exact formula, it's here:

http://www.cs.rit.edu/~ncs/color/t_convert.html

I believe photoshop is using this type of perceptual transformation to convert rgb to gray. If this is true, you can get lots of different rgb-to-grayscale variations using the Channel Mixer, but they will never exactly reproduce Mode->Grayscale no matter what values you put it, since the transformation is mathematically, fundamentally different.

-Adam

Roger_Cavanagh
19th of September 2002 (Thu), 04:16
adamsmith wrote:
I believe photoshop is using this type of perceptual transformation to convert rgb to gray. If this is true, you can get lots of different rgb-to-grayscale variations using the Channel Mixer, but they will never exactly reproduce Mode->Grayscale no matter what values you put it, since the transformation is mathematically, fundamentally different.

-Adam

Adam,

Do you think this is of any practical significance working with PS? If this sounds a bit sarcastic, it is not meant to be. :) I'd just like to explore the issue a bit more.

I've never done any B&W film stuff and only ever convert the odd D30 image to B&W, so I'm not claiming great expertise here. Surely, one aim of B&W is to produce a stronger image by removing the "distraction" of colour. From what I understand, the processes and materials used in developing and printing in B&W offer a great deal of control over tonality. I know that Michael Reichmann for one has given up using B&W and uses the channel mixer method in Photoshop. It would be interesting to hear the experiences of other "converts" like Michael.

Regards,

adamsmith
19th of September 2002 (Thu), 12:03
I don't think there is huge practical significance. I mention it only because a few of the sites you listed earlier in this thread disparage photoshop's built-in grayscale conversion, implying that is inferior to channel mixing simply because it gives less user control and is less like B&W film (without further curves/levels tweaking, that is). I'm a little more open-minded about photoshop's conversion; I find that the results can be very useful even as an extra layer in a multi-step conversion process. It gives you access to a type of tonal conversion that you just can't get with channel mixing alone.

For anyone wanting to explore all the ways to convert rgb to gray, there is really no harm in understanding all your options. The better you know your tools, the easier it will be to get the exact results you are after.

Case in point, many of the web's RGB-to-BW conversion "tutorials" recommend mixer settings that will not work well for all source images, or give good results. One I came across said to "not mix in any of the red channel, since it's noisy". This is just not true for all digital cameras. Many 3MP cameras have red channel noise, but others have the most noise in the blue channel, so mileage with this suggestion will vary.

To answer the original poster's question as best as I can understand it, there is no way to get "RAW grayscale" from the RAW image file. The CCD/CMOS itself has RGB filters over discrete photodiodes, so the only way your are going to get grayscale is by some numerical transformation from RGB to gray space. Which transformation you use depends on what look you want. Purists might recommend writing your own conversion algorithm based on the exact response curves and noise characteristics of your favorite black and white film. For others, a decent amount of experimentation can get very close results. Fred Miranda's site has some nice examples of how he's been able to put together photoshop actions to make convincing emulations of Tri-X film, for example. I don't know if he did it with lots of trial and error, or based on scientific measurement of tri-x film, but his results are great.

-Adam

miro
19th of September 2002 (Thu), 15:25
There is a plugin for Photoshop from The Imaging Factory called Convert to B/W Pro. It can convert rgb image to b/w using red, orange yellow, green, etc (and custom) filters and match color response of several b/w films (agfa, iiford, kodak or custom). Works really well.

Here is url:

http://www.theimagingfactory.com/

aneilson
19th of September 2002 (Thu), 16:35
Adam

If you have a look at the deafult production actions that come with photoshop, you wil see a custom grayscale action, The default settings for this is R24 G68 B8 . If you type these in the monochrome channel in an adustment layer, you get a perfect match against the menu image>grayscale option.

The histogram is identical with identical mean standard deviation and median.

I would post some images and histograms if I could find out how.

thoughts?

Andy

adamsmith
19th of September 2002 (Thu), 16:57
I can't duplicate those results at all. What kind of image are you converting? Here is what I just did, I tested Mode->Grayscale against channel mix 24/68/8 on this RGB gradient sample. Here are the results. It is easy to see that the Mode->Grayscale version does not have 8% mix of blue, look what happened to the solid blue stripe:

http://www.airraidsirens.com/grayscale2.jpg

The top is obviously the color original. The middle result is that from Mode->Grayscale, and the last is a monochrome channel mix of 24% red, 68% green, 8% blue.I should mention that I'm using photoshop 7.0, maybe it's different in other versions?

In my mode->grayscale result, the pure red became 52% gray, green 84%, blue 33%. But these are only the ratio of the pure colors, the ratio is non-linear across the range of each gradient. Therefore, it can't just be a weighted average.

-Adam

aneilson
19th of September 2002 (Thu), 17:33
Adam

How do I insert images into the messages I post? I will post the image I looked at if you can tell me this

Andy

adamsmith
19th of September 2002 (Thu), 18:08
You need some place to host the image, then you put the link between BBCode IMG tags. These are your image URL here but using square brackets instead of angle brackets. I show it here with angle brackets because if I typed in square brackets it would of course be interpreted as an image.

Alternately, you can email me the image at adam'AT'airraidsirens.com, and I'll check out what photoshop does to it.

-Adam

aneilson
20th of September 2002 (Fri), 01:42
Thanks, I saw this syntax in the help screen but thought that there might have been a way to attach from a local drive rather than an html address. I will email the image when I get out of the office

Andy