Luminous Landscape Forum

Raw & Post Processing, Printing => Digital Image Processing => Topic started by: dreed on May 03, 2012, 10:32:37 am

Title: Monochrome r/g/b images from raw?
Post by: dreed on May 03, 2012, 10:32:37 am
Are there any software packages that generate monochrome images from just one of the r/g/b channels in a raw file that do not invent extra pixels?

To give you an idea of what I mean, from a 20MP raw file, I'd expect a 5MP "blue" file, a 5MP "red" file and a 10MP "green" file.
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 10:34:47 am
As far as I know, there are no "channels" in a raw file. The image needs to be rendered as an RGB image. Then in Photoshop you can go to the Channels palette and work with individual channels.
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 10:53:59 am
Are there any software packages that generate monochrome images from just one of the r/g/b channels in a raw file that do not invent extra pixels?

To give you an idea of what I mean, from a 20MP raw file, I'd expect a 5MP "blue" file, a 5MP "red" file and a 10MP "green" file.


http://www.libraw.org/docs/Samples-LibRaw-eng.html

"...4channnels - splits RAW-file into four separate 16-bit grayscale TIFFs (per RAW channel).
Command line switches:

    -s N selects N-th image from RAW with multiple images
    -g gamma correction (gamma 2.2)
    -A values autoscale by auto-calculated integer factor
    -B turn off black subtraction
    -N no RAW curve

..."
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 10:58:43 am
For anyone who has the appetite to get into all that. Fundamentally though, from what I see, it creates (not extracts) TIFF image channels from the raw file.
Title: Re: Monochrome r/g/b images from raw?
Post by: sandymc on May 03, 2012, 11:00:14 am
Are there any software packages that generate monochrome images from just one of the r/g/b channels in a raw file that do not invent extra pixels?

To give you an idea of what I mean, from a 20MP raw file, I'd expect a 5MP "blue" file, a 5MP "red" file and a 10MP "green" file.


There are few additional options that will show that in various forms:


Not sure whether any of them generate separate files.

Sandy
Title: Re: Monochrome r/g/b images from raw?
Post by: joofa on May 03, 2012, 12:20:04 pm
Are there any software packages that generate monochrome images from just one of the r/g/b channels in a raw file that do not invent extra pixels?

To give you an idea of what I mean, from a 20MP raw file, I'd expect a 5MP "blue" file, a 5MP "red" file and a 10MP "green" file.


I have made a free Photoshop plugin that separates r/g/g/b channels into individual images. It can also display them together in a single image as a Bayer RGGB pattern. You can download it from http://djjoofa.com/download. However, it does not give you a single green image, rather two separate green images coming from two green channels in the Bayer pattern. At this stage it only works on Mac Os 10.6.8 and Photoshop CS3, though.

Joofa
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 04:34:58 pm
For anyone who has the appetite to get into all that. Fundamentally though, from what I see, it creates (not extracts) TIFF image channels from the raw file.

it does exactly what OP was asking for... TIFF is a just a container for the raw data extracted from raw files... each file contains one channel (R, G1, B, G2)...

PS: G1 != G2 hence you get 2 files instead of 1 (as OP was hoping for).
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 04:56:04 pm
it does exactly what OP was asking for... TIFF is a just a container for the raw data extracted from raw files... each file contains one channel (R, G1, B, G2)...

PS: G1 != G2 hence you get 2 files instead of 1 (as OP was hoping for).

Do I understand right that you are saying what ends-up in these TIFFs as separated channels are not formed of pixels with bit-depth, or they don't then need to be converted into channels of pixels at a certain bit-depth to be worked with?
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 03, 2012, 06:04:15 pm
There are few additional options that will show that in various forms:

  • draw with the -D option

draw or dcraw? dcraw with -D would give me a full size B&W image, not ... maybe I wasn't driving it right?

Quote
  • dng_validate with the -b4 option

I'm not sure what this was meant to do, but there seems to be no option to dng_analyze (found in the DNG SDK) that allows you to output just a single channel.

Quote
  • RawAnalyze

I tried this but I wasn't at all sure about what I was doing. Similarly, I couldn't work out how to create an image file of just one channel, if that is possible.

Quote
  • RawDigger

Wanted to phone home over the Internet so I uninstalled it. (This means it would not operate unless it could make a connection to some host on the Internet. It's an application for working with photos, not a web browser, so no, it does not get to connect to the Internet.)
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 03, 2012, 06:06:05 pm
http://www.libraw.org/docs/Samples-LibRaw-eng.html

"...4channnels - splits RAW-file into four separate 16-bit grayscale TIFFs (per RAW channel).
Command line switches:

    -s N selects N-th image from RAW with multiple images
    -g gamma correction (gamma 2.2)
    -A values autoscale by auto-calculated integer factor
    -B turn off black subtraction
    -N no RAW curve

..."

Windows .exe?
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 06:18:23 pm
Windows .exe?

..

http://www.libraw.org/data/LibRaw-0.14.6-Win32.zip

do not ask me how to extract from archive though !
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 06:20:05 pm
Wanted to phone home over the Internet so I uninstalled it. (This means it would not operate unless it could make a connection to some host on the Internet. It's an application for working with photos, not a web browser, so no, it does not get to connect to the Internet.)

sure, KGB wants your raws !
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 06:23:27 pm
Are there any software packages that generate monochrome images from just one of the r/g/b channels in a raw file that do not invent extra pixels?

To give you an idea of what I mean, from a 20MP raw file, I'd expect a 5MP "blue" file, a 5MP "red" file and a 10MP "green" file.


Going back to the OP in light of some of the responses here, it seems to me that the proposed options are rather arcane - in the sense that they require very above average computing skills to work with them. I'm wondering what the purpose of the request is and in that context whether there is a simpler, more conventional solution.
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 06:23:46 pm
Do I understand right that you are saying what ends-up in these TIFFs as separated channels are not formed of pixels with bit-depth, or they don't then need to be converted into channels of pixels at a certain bit-depth to be worked with?

to make it simple... it takes all 12/14 bit values recorded for same "color" (R, G1, B, G2) sensels and dump them all into a separate 16bit tiff file... so you will end up w/ values for all R sensels in r-tiff, values for all G1 sensels in g1-tiff, etc... no demosaicing of any kind... 4 files, each 4 times less dimension wise than original raw
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 06:27:39 pm
to make it simple... it takes all 12/14 bit values recorded for same "color" (R, G1, B, G2) sensels and dump them all into a separate 16bit tiff file... so you will end up w/ values for all R sensels in r-tiff, values for all G1 sensels in g1-tiff, etc... no demosaicing of any kind... 4 files, each 4 times less dimension wise than original raw

OK, taking it further then, what in your view is the difference between these results and what you get from individual image channels in say Photoshop?
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 06:31:35 pm
Going back to the OP in light of some of the responses here, it seems to me that the proposed options are rather arcane - in the sense that they require very above average computing skills to work with them. I'm wondering what the purpose of the request is and in that context whether there is a simpler, more conventional solution.

may be likes "it" raw... by the way for a B/W photo sometimes I like to use undemosaicked image, w/ no WB or camera profiles applied, raw data output ( -NoCFA YES flag in RPP - it will output a greyscale 16 or 32 bit image) - just a curve and exposure adjustment - move it to photoshop and finish there... even from a camera w/ CFA not removed
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 03, 2012, 06:44:13 pm
..

http://www.libraw.org/data/LibRaw-0.14.6-Win32.zip

do not ask me how to extract from archive though !

Thanks! 4channels.exe does exactly what I wanted.
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 06:53:18 pm
OK, taking it further then, what in your view is the difference between these results and what you get from individual image channels in say Photoshop?

1) no demosaicking happened

2) pixels = same type sensels (only R sensels or only B sensels or only G1 sensels or only G2 sensels - other channels are totally removed)
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 03, 2012, 07:10:34 pm
I should expand on this a little...

My interest here was to see how B&W images that result from using just a single channel of pixels compares with downsizing a colour image converted into B&W.

Also in this test is to see if there is less chromatic aberration due to different wavelengths focusing at different locations on the sensor.

Finally, it gives me a good sense for how much sharpness I should be applying in LR. Before being able to look at the per-channel images, I was just guessing about how much correction to apply (if any.)

The catch is that the output from 4channels.exe does need work (brightening, etc) before it is really usable.

As an example of the difference, I've included 3 attachments. One is just the red channel from the file, one is colour (no adjustments) from LR, and one is after colour to B&W (no other adjustments) in LR. Of course the catch here is that the red channel is 1/4 of the size of the other two.
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 07:31:42 pm
My interest here was to see

if you just want to see then rawdigger is the software to use...

if still paranoid

Quote
Error message: "RawDigger BETA cannot continue without Internet access"

RawDigger Beta relies on Internet access for timely updates and will not work without it. We apologize for this inconvenience but we need to ensure the User has the last available version of the program. This allows for more efficient technical support.

RawDigger reads the settings for Internet access from the system setings (Control Panel -> Internet Options -> Connections -> LAN Settings).

To disable the update check on the next program run you can double-click on noCheckUpdates.reg located in C:\Program Files\LibRaw\RawDigger. Windows Registry Editor will be started and update check will be disabled for the consequative RawDigger run. The setting has one-time effect and is reset upon the program start. To restore it for the next program start you need to repeat the above procedure.

you can script that into some batch file like

regedit /s "C:\Program Files (x86)\LibRaw\RawDigger\noCheckUpdates.reg"
"C:\Program Files (x86)\LibRaw\RawDigger\rawdigger.exe"

OR

REG ADD "HKEY_CURRENT_USER\Software\LibRaw LLC\RawDigger\Tweaks" /v "noCheckUpdates" /t REG_DWORD /d 1 /f
"C:\Program Files (x86)\LibRaw\RawDigger\rawdigger.exe"

Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 07:56:09 pm
1) no demosaicking happened

2) pixels = same type sensels (only R sensels or only B sensels or only G1 sensels or only G2 sensels - other channels are totally removed)

OK, got that, but the software has to be converting that information into something viewable - probably grayscale pixels (for each primary) representing each of those sensels at 16-bit depth. So then two questions arise: if the purpose is to see the grayscale image of each of the R, G, or B primaries, what advantage is there going about it this way, versus Photoshop's disaggregation of the demosaiced data in the Channels palette? Would it tell us much of practical usefulness about the quality of the demosaicing? I'm asking because I'm wondering.
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 03, 2012, 08:03:51 pm
Ok, so I tried RawAnalyze and it gets a bit confused when you select only one channel to work with when deciding what is and isn't 100% zoom

OK, got that, but the software has to be converting that information into something viewable - probably grayscale pixels (for each primary) representing each of those sensels at 16-bit depth. So then two questions arise: if the purpose is to see the grayscale image of each of the R, G, or B primaries, what advantage is there going about it this way, versus Photoshop's disaggregation of the demosaiced data in the Channels palette? Would it tell us much of practical usefulness about the quality of the demosaicing? I'm asking because I'm wondering.

I wasn't aware that Photoshop could work with the separate channels of raw files principally because it doesn't know about raw files at all - Adobe Bridge does. Or am I missing something?

Update:
As a case in point regarding the question of "what does it tell us", as can be seen in the earlier attached images, the demosaic'd colour file has fringing where the white of the snow on the mountain meets the blue sky. There is no such artifact when using a single (in this case red) channel from the raw file. At the very least, with no sharpening it suggests that the demosaic is introducing colour artifacts.
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 08:07:06 pm
I should expand on this a little...

My interest here was to see how B&W images that result from using just a single channel of pixels compares with downsizing a colour image converted into B&W.

Also in this test is to see if there is less chromatic aberration due to different wavelengths focusing at different locations on the sensor.

Finally, it gives me a good sense for how much sharpness I should be applying in LR. Before being able to look at the per-channel images, I was just guessing about how much correction to apply (if any.)

The catch is that the output from 4channels.exe does need work (brightening, etc) before it is really usable.

As an example of the difference, I've included 3 attachments. One is just the red channel from the file, one is colour (no adjustments) from LR, and one is after colour to B&W (no other adjustments) in LR. Of course the catch here is that the red channel is 1/4 of the size of the other two.

Well, on your first point, of course there is no comparison because a conversion to B&W relies on all three primaries, which inherently must be a very different result from that given by any one of the constituent primaries in islolation, so not clear what's the purpose behind it.

On the second point, CA is the result of what your lens does when the image is exposed and LR has profiles and manual controls for correcting it very efficiently, so again, I may be missing something but I have trouble perceiving the value-added of the difficult approach.

On the third point, there is excellent instruction available for LR4 on how to evaluate and control sharpness using the grayscale rendiition of the image that you can trigger easily when using the sharpening panel tools.

So I remain somewhat mystified about the usefulness of bothering with the hard way, but of course an interesting intellectual odyssey from which something useful could emerge - so I'm not knocking it, just wondering about value-added and usefulness.
Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 08:07:34 pm
OK, got that, but the software has to be converting that information into something viewable - probably grayscale pixels (for each primary) representing each of those sensels at 16-bit depth.

yes, certainly when you visualize it to see w/ your eyes (and not to feed into some software to crunch that numbers) then you (software) do some operations to ultimately display the data... but you do some operations to display the data from jpgs for example... raw file is an image, the mere fact that WB is not applied, curves are not applied, demosaick did not happen, data is not transformed into some color space, etc does not make raw file a non image... you can view it with a proper software like you view your jpgs... you can view all 4 channels at once or you can view it per channel... get rawdigger - it is a nice visualizer.



Title: Re: Monochrome r/g/b images from raw?
Post by: deejjjaaaa on May 03, 2012, 08:09:10 pm
Ok, so I tried RawAnalyze

rawanalyze is not updated anymore as its author, mr Gabor Schorr, died in 2010... use rawdigger.
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 08:10:42 pm
Ok, so I tried RawAnalyze and it gets a bit confused when you select only one channel to work with when deciding what is and isn't 100% zoom

I wasn't aware that Photoshop could work with the separate channels of raw files principally because it doesn't know about raw files at all - Adobe Bridge does. Or am I missing something?

Update:
As a case in point regarding the question of "what does it tell us", as can be seen in the earlier attached images, the demosaic'd colour file has fringing where the white of the snow on the mountain meets the blue sky. There is no such artifact when using a single (in this case red) channel from the raw file. At the very least, with no sharpening it suggests that the demosaic is introducing colour artifacts.

Photoshop isn't working with separate channels of raw files. It is working with separate channels of rendered raw files - different things.

What I see in your second image is a pure case of CA - it most likely has nothing to do with demosaicing, and you would of course not see it through one channel alone - that doesn't mean it isn't there and that it wasn't created by your lens.
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 08:14:48 pm
rawanalyze is not updated anymore as its author, mr Gabor Schorr, died in 2010... use rawdigger.

That's really sad to learn. Gabor was a respected, expert contributor to the digital imaging community.
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 08:18:37 pm
yes, certainly when you visualize it to see w/ your eyes (and not to feed into some software to crunch that numbers) then you (software) do some operations to ultimately display the data... but you do some operations to display the data from jpgs for example... raw file is an image, the mere fact that WB is not applied, curves are not applied, demosaick did not happen, data is not transformed into some color space, etc does not make raw file a non image... you can view it with a proper software like you view your jpgs... you can view all 4 channels at once or you can view it per channel... get rawdigger - it is a nice visualizer.

OK, I hear you - nice for visualizing data that has been tinkered with as little as possible while still allowing one to see what the sensor captured. Not a bad idea, and even better if I could conjure-up what I would use it for, apart from the intellectual curiosity.
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 03, 2012, 09:03:27 pm
I wonder what impact (if any) it has on noise, as rather than deal with noise from all three colour channels, there is only one.

Does that make noise easier to manage, harder, less or more prevalent?

Or is there no difference at all?
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 03, 2012, 09:12:45 pm
There is good noise reduction software on the market allowing you to manage noise channel by channel.
Title: Re: Monochrome r/g/b images from raw?
Post by: jerryrock on May 04, 2012, 12:50:42 am
There is good noise reduction software on the market allowing you to manage noise channel by channel.

Photoshop
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 04, 2012, 01:53:59 am
Well then maybe being able to do this remains something just for those that are curious :)
Title: Re: Monochrome r/g/b images from raw?
Post by: Mark D Segal on May 04, 2012, 06:21:36 am
Well then maybe being able to do this remains something just for those that are curious :)

I agree, and I would say not only that, but perhaps useful to software developers, programmers, code writers for any analytic insight it can provide for their work.
Title: Re: Monochrome r/g/b images from raw?
Post by: PierreVandevenne on May 04, 2012, 06:52:55 am
Iris

use either the menus or the splitCFA command

http://www.astrosurf.com/buil/iris/tutorial5/doc17_us.htm
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 10, 2012, 06:25:00 am
Does colour moire exist in a single channel of an image captured with a Bayer matrix sensor?

If so, what does it look like in B&W?
Title: Re: Monochrome r/g/b images from raw?
Post by: fdisilvestro on May 10, 2012, 07:28:32 am
There might be aliasing or moire, but no "colour". It will look as a pattern not present in the original captured scene.

You will actually get more aliasing than if you use the 4 channels and perform demosaicing. When using only one raw channel, you have 1/4 of the resolution, and even if your camera had an AA filter, it would be too weak for just one channel.
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 10, 2012, 08:42:48 am
There might be aliasing or moire, but no "colour". It will look as a pattern not present in the original captured scene.

You will actually get more aliasing than if you use the 4 channels and perform demosaicing. When using only one raw channel, you have 1/4 of the resolution, and even if your camera had an AA filter, it would be too weak for just one channel.

Well, I for one would like to see if and how it is different when just a single channel is looked at.

Note, this is only applicable when moire is visible at 100% when rendered raw files.
Title: Re: Monochrome r/g/b images from raw?
Post by: fdisilvestro on May 10, 2012, 10:16:04 am
Some interesting info in this thread:

http://www.luminous-landscape.com/forum/index.php?topic=58661.0 (http://www.luminous-landscape.com/forum/index.php?topic=58661.0)
Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 10, 2012, 05:07:53 pm
Some interesting info in this thread:

http://www.luminous-landscape.com/forum/index.php?topic=58661.0 (http://www.luminous-landscape.com/forum/index.php?topic=58661.0)

All of the images in that thread were created by rendering an image from the raw file, they were not created by just extracting a single channel's data.

And as a "for example" of why I find this interesting, Leica's new 18MP monochrome camera is without an AA filter...
Title: Re: Monochrome r/g/b images from raw?
Post by: fdisilvestro on May 10, 2012, 08:34:44 pm
And as a "for example" of why I find this interesting, Leica's new 18MP monochrome camera is without an AA filter...


It is still possible to get images with aliasing even if you don't perform interpolation, so the M Monochrom will not be inmune to this.
Aliasing happens when the frequency of the signal is above Nyquist frequency of the sampling device.


Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 10, 2012, 08:58:20 pm
It is still possible to get images with aliasing even if you don't perform interpolation, so the M Monochrom will not be inmune to this.
Aliasing happens when the frequency of the signal is above Nyquist frequency of the sampling device.

From today's review by Michael:


But, there's more going on. To create a colour image a Bayer sensor is, in fact, "guessing"; or interpolating between the various cells to recreate a colour rendition. As a consequence, down at the pixel level there is a "fudging" going on. This is what leads to the possibility of colour moire, when an interference pattern occurs between the Bayer array and very fine patterns in the real world (fabrics, bird feathers, etc). Even when you later take away colour in post processing there are still interference artifacts remaining.

The Leica Monochrom M has none of these issues, because there is no Bayer array. Therefore actual resolution is higher that a Bayer sensor with the same number of pixels, and there is no possibility of either colour moire or related artifacting.


This I find quite interesting. I suppose I'm just going to need to find a subject that produces moire at 100% and test this out for myself.
Title: Re: Monochrome r/g/b images from raw?
Post by: fdisilvestro on May 10, 2012, 10:32:03 pm
Well, being Monochrome it will not produce "colour" moire for sure, but it will definetly be possible to get aliasing, it is basic digital signal processing theory.

To illustrate this, the first chart shows a signal to be sampled together with a sampling signal with too low frequency. The second chart shows the samples obtained and a recostructed ouput signal, which is at a lower frequency compared to the origial. This is basically what happens, the output does not resemble the original signal (aliased).

Title: Re: Monochrome r/g/b images from raw?
Post by: dreed on May 10, 2012, 11:02:06 pm
Well, being Monochrome it will not produce "colour" moire for sure, but it will definetly be possible to get aliasing, it is basic digital signal processing theory.

Look, I don't even need a camera to create moire - I can easily write a Java program to draw a problematic pattern on the screen very easily. All of those test images will produce moire, in one fashion or another, on a computer screen if they're drawn without aliasing techniques. A camera isn't required to produce moire.

What I'm interested in is what happens in real life, not on some special wheel pattern that is known to produce moire. That's uninteresting.

What I want to know is what (say) the raw red channel looks like from an image that has been taken of (say) a building with vertical stripes that when looked at with 100% magnification in colour, exhibits moire.
Title: Re: Monochrome r/g/b images from raw?
Post by: Bart_van_der_Wolf on May 11, 2012, 03:49:30 am
What I'm interested in is what happens in real life, not on some special wheel pattern that is known to produce moire. That's uninteresting.

Hi,

It's not the pattern that produces the moiré, it's the undersampling by the sensor that does, just as with real life subjects. The predictable pattern just makes it easier to see, because everything that deviates from the expected pattern will stick out like a sore thumb. Even random (non-repetitive) patterns will have aliasing, you just won't notice it, unless the color deviates from the expected.

Quote
What I want to know is what (say) the raw red channel looks like from an image that has been taken of (say) a building with vertical stripes that when looked at with 100% magnification in colour, exhibits moire.

In this thread (http://www.luminous-landscape.com/forum/index.php?topic=39952.msg331653#msg331653) Guillermo explains how you can use the non-demosaiced output from DCRaw together with a 50% nearest neighbor downsampling to isolate the single channels. You'll just have to figure out which channel it is you're looking at before/after adding a column/row before downsampling. Obviously the red channel will show red object colors as brighter (after whitebalancing) than green and blue.

Cheers,
Bart