Jump to content

DSLR Bayer matrix question


sgazer

Recommended Posts

hi,

with a DSLR (specifically a Canon 1000d), is it possible to extract the red green and blue data seperately from the individual pixels (under each colour filter) from a RAW file? Is this what de-bayering is?

In Photoshop when you select to view each RGB channel, is it effectively doing this?

I'm interested to know if the R, G and B filters in the Bayer matrix can be used as actual filters.

Thanks

Link to comment
Share on other sites

I'm really not sure exactly on this stuff... I don't believe you can extract the channels in the way you mean... Have a look at the DSS help... There's some good information in there on the debayer process.

Link to comment
Share on other sites

Sgazer

You're right. The CCD is made up of a large number of 2x2 matrices each normally comprising 1xred, 1xblue and 2xgreen 'filters'. This is the Bayer matrix. De-bayering means extracting the pixel values for each of the filters separately and creating separate R, G and B images. Of course there are several combinations of how the three colours are arranged in the matrix eg RGGB or GRBG etc and the software which extracts the colour channels needs to know the arrangement of your particular CCD. Once the software has created the separate R, G, B frames then they can be combined and processed in the same way eg by PS, as any other RGB images

HTH

Steve

Link to comment
Share on other sites

SG

Since DSS provides some simple processing of the RGB image, it would need to have de-bayered the raw image in order to have created the RGB channels. So DSS might well be a good start.

Alternatively, have a look at the Canon Utilities which came with your camera - they may well have some mechanism for extracting the different channels

Steve

Link to comment
Share on other sites

Caution

Depending on the de-bayering method ( software solution) the amount of sharing of data (ie colour) between the various pixels varies. Also there's colour "leakage" from the RGB filters on the chip ie some red is recorded on the green/ blue pixels.

There's a very good write up available:

http://www.stark-labs.com/craig/articles/assets/Debayering_API.pdf

Ken

Link to comment
Share on other sites

thanks for all the info, it pointed me to look in the right direction.

I found that IRIS can do it using the SPLIT_CFA S1 S2 S3 S4 command. It will split a raw file into the 4 seperate coloured pixels (S1=green 1, S2=blue, S3=red, S4=green 2). The resulting images for each channel are 1/4 the size, proving that it's only chosen 1 of the 4 bayer matrix pixels for each colour. It is indeed different to just looking at the red channel in photoshop.

I think this opens up the possibility of narrowband imaging with a DSLR as talked about in this link;

http://www.stark-labs.com/craig/articles/assets/LineFilterRecon_API.pdf

(thanks for your link Merlin as it then pointed me to this one).

because the green and blue pixels can be thown away from the raw image before processing, just keeping the red pixels for a Ha image for example, so the others don't introduce noise.

Link to comment
Share on other sites

possibly, I did try the excecutable version of dcdraw, but couldn't work out its command line interface before I tried IRIS.

I'm thinking now to look back on my earlier images. As I always used a CLS filter with a 40nm bandpass around Ha and more recently a Celestron filter with a 30nm band pass around Ha and because my DSLRs have been modified, in theory I've been taking Ha images, albeit with 40nm and 30nm bandpasses, if I extract the red only pixels. Well it's certainly worth a bit of experimentation.

Also, as I have some Baader solar film on the way and I've been following the thread on the "solar continueum filter vs a green filter", I thought about doing some sun images and extracting the green pixels. I do have a dark green filter, but it's only 1.25" so might also try that on the Mintron video camera.

Link to comment
Share on other sites

Just thinking out loud.

If I understand you want to split a sequence of raw files captured with a colour dslr into separate red, green and blue sequences. Then you want to select just the red files (pixels) and stack them in DSS and then process them in Photoshop as though you had used a mono ccd camera with a Halpha filter.

The problem I think you will face is deciding how to best include flats and darks when you stack the red files in DSS. You could end up introducing artifacts due to the software based deBayering process.

Would you need to stack the raw lights, flats and darks and them split the resultant and just keep the red?

Of course, given you have the data the fun would be trying it both ways and seeing what you get.

If it works it certainly opens up some interesting possibilities.

Link to comment
Share on other sites

yep, that's pretty much it. Not sure how well the darks and flats will work, but I'll initially try the same method of extracting just the red pixel data from them and stack a few frames to begin with and see how it works out. It's something to have a mess with whilst the clouds are here anyway!:) Craig's articles above (from Starklabs) are far from dismissing it, so it will be interesting to try it out.

Link to comment
Share on other sites

If I understand what I've read the favoured approach on the Meade DSI Yahoo forums is to do all of the DSS work with the raw lights, flats, darks, etc then split the colours. This is what I'm experimenting with anyway.

Craig's articles are very good reading.

Have you read, “Line Filter Image Reconstruction on One-Shot Color

Cameras".

That certainly doesn't dismiss the idea.

Link to comment
Share on other sites

my thoughts about that approach (stacking in DSS first) were that the RAW file has already been de-bayered into a TIFF file (or other format), hence the RAW red data has already been modified. (I'm no imaging expert, but that would be my first concern). However, there is an option in DSS to create super-pixels from the RAW bayer matrix and the resulting image size is 1/4 of the original as a result, but it's still combining the RGGB pixels, so I'm not sure if the red channel would still be the original red pixels. Only way to find out is a bit of experimentation.

Link to comment
Share on other sites

You can certainly do this in IRIS.

When preprocessing in IRIS, this works on the RAW images, and only afterwards would you normally convert them to rgb (ie. debayer).

Alternatively you can split an image into its 4 colour components.

See the tutorial "Split a CFA image".

I am not 100% sure, but I am pretty confident that IRIS does not use dcraw.

/callump

Link to comment
Share on other sites

my thoughts about that approach (stacking in DSS first) were that the RAW file has already been de-bayered into a TIFF file (or other format), hence the RAW red data has already been modified. (I'm no imaging expert, but that would be my first concern). However, there is an option in DSS to create super-pixels from the RAW bayer matrix and the resulting image size is 1/4 of the original as a result, but it's still combining the RGGB pixels, so I'm not sure if the red channel would still be the original red pixels. Only way to find out is a bit of experimentation.

Normally, a one shot colour image comes out as the same width and height as the number of pixels on the chip, but that means it is interpolating the colours for the pixels. e.g. in a Bayer matric of RGGB, the top row looks like:

RGRGRGRGRGRG<etc>

but the DSLR image that gets spate out has full RGB for each pixel. The extra two colours are being interpolated from the surrounding pixels to create what appears to be some kind of close match to what it should be.

Super Pixel doesnt do this. It takes the 2x2 matrix of RGGB (or variations) and creates one pixel from this group. The red part of the pixel is taken from the red pixel, the blue from the blue, and the green is taken from (I assume the average of) the two green pixels.

For Ha narrowband, the red data that is spat out is the red data you captured. For OIII its a bit weird, as the green and blue channels both pick up some of that emission line (more green than blue, but not by much).

But... as you have two green pixels, you have just captured twice as much data as tyou would have normally expected. The downside of using superpixel for OIII is that the green channel gets a bum deal if you want to use a sigma stack routine. Any individual green pixel will be averaged with its neighbouring green pixel, so any outliers that would get removed by sigma stacking will be lessened.

For OIII I would strip out all the channels and stack the two sets of green seperately, then stack the results from each with each other.

The OIII stuff is all theory for me, but its something I have been looking at for a while, and bonus time (tomorrow) will allow me to get some of the extra kit I need to get to work on this for my OSC CCD.

Link to comment
Share on other sites

ok, an update on progress. I stacked 25 subs of the Californian nebula (strong in Ha), firstly just the original RAWs and then selected only the red channel in PS, then stacked 25 subs with the red only pixels extracted in IRIS. Comparing the two in PS, there's a significant difference. Much better contrast and much lower noise with the red only pixels, compared with the red only channel from the RAWs.

I also tried using the same process with darks and flats, but the result didn't come out well, very noisy and the flats didn't work well. So perhaps some work to do there.

The down side is that in IRIS, each sub has to be CFA split manually using the command line entry which can take a while.

The other option I'm trying in DSS is the Bayer drizzle algorithm as, according to the desciption, it keeps the Bayer as it is, however I'm having some funny results at the moment from 25 subs, but not with just a few subs, so there might be one sub affecting the result, which I'm trying to find through a process of elimination!

......would you believe it, it was sub #13! Should have checked that one first!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.