Color, CFA, Alpha MILC, color casts, sanity check on process

Linwood

Well-known member
Jul 28, 2020
71
4
Very, very new to Pixinsight as well as AP in general. I am capturing with a Sony A7Riv, in uncompressed raw.

What I've gathered from various documents is I should:

- capture the raw data, including for flat, bias and dark
- Create master flat, bias and dark, anywhere "CFA" is mentioned let it detect and/or check the box.
- Go through cosmetic correction like that, then debayer

When I debayer it automatically finds it for real raw, and those captured as FIT by APT I have to tell it RGGB, but I've verified I get the same image to that point whether FIT or raw.

After all that I get a strong, strong color cast. The latest set was bright blue.

So as an experiment I took a shot of a Macbeth chart and processed it through debayer. It's really green. So (thinks I) I have 2 greens, and indeed if I got into curves and drop green about half it looks better. But I also read that Debayer is supposed to be handling that for me. Even after adjusting green it's a poor color result.

A lot of advice seems to be "ignore it all, work it out in subsequent steps". Ok, I can (and have) done that.

But my question is more fundamental -- what should I have gotten? Is there something wrong in my steps to the debayer point that leads to a strong color cast, notably on a terrestrial shot of a color chart. Or is all this just plain normal and "fix it in post" is the motto?

Thanks,
Linwood

colors.jpg
 

pfile

PTeam Member
Nov 23, 2009
5,631
106
this is pretty normal. are you running autoSTF with the channels locked or unlocked?

as you said there are 2 green pixels in the bayer matrix. when the file is debayered, these two green pixels are averaged together to form the green pixel that corresponds to the nearby red and blue pixels. and then there is interpolation done to create the "missing" green pixels where the red and blue pixels are (and likewise for the other channels), unless you are using "superpixel" debayering.

because of the 2 green pixels per bayer quad, the SNR of the green channel in the debayered result is 1.4x the SNR of the other two channels. since autoSTF is looking at the histograms to figure out how to stretch the file, you usually end up with a green cast. having said that, because the flat is divided into the light, if the flat is not grey you can then get a different color cast depending on which channel was the weakest in the flat. again, nothing to be concerned about as the image needs to go thru color calibration eventually, and any of these casts will be fixed.

adobe camera raw does a whole lot of stuff to a raw image to present you with the "correct" image from the camera. when loaded "pure raw" in PI, none of this stuff happens, thus the funky results. but it is OK as we have our own color calibration tools, some of which are specific to astrophotography (like PhotometricColorCalibration.)
 

Linwood

Well-known member
Jul 28, 2020
71
4
Thank you. I already learned something -- I didn't know about the lock together of the RGB channels in the stretch. Got it now. They were locked, it looks a bit better unlocked.

I do end up OK after all is done, there's plenty of opportunity for adjusting curves and saturation, but I was worried the muddy result I was seeing after debayer was indicative of some other problem. Thanks for the reassurance.
 

Linwood

Well-known member
Jul 28, 2020
71
4
Can I throw in a slight twist to this. Whether raw Sony ARW files, or raw in FITS from APT, I am finding the maximum value is 16380+/-, i.e. 2^14. That fits with 14 bit images from Sony.

It means (I think) that both the process through APT (probably the driver) and PI's intake (CDraw?) are leaving the data unscaled.

So (for example) flats taken at about half the max value show up as far, far left on any histogram.

I'm thinking that none of this matters so long as all the light, bias, dark and (probably less so) flats are similarly non-scaled. Everything is relevant.

Is that correct? Is that what you should anticipate seeing once opened?
 

pfile

PTeam Member
Nov 23, 2009
5,631
106
that's good - it means that APT doesn't scale the files at all. SGP does, which makes CR2/NEF/ARW files incompatible with SGP-generated FITS files for purposes of calibration. however, the rescaling does have a benefit in that you probably never have the "pink stars" problem that sometimes arises with 14-bit saturated data not being saturated in a 16-bit space anymore. still, mixing fits/RAW from SGP has bitten many people and i'm not sure if the benefits are better than the drawbacks. it's a real tradeoff.

PI uses libRAW for RAW file handling.

it is true that back-of-camera histograms for flats look "better" that what you see when you open them in linear mode. they are probably also underexposed a tad since the camera is pretty conservative when set to any automatic mode. i used to shoot flats with my canon cameras with AV+2EV just to get the signal up. but in the end all that matters is that your weakest channel has a high enough SNR so as not to corrupt your lights. even an underexposed flat is way above the read noise of the camera, so just taking more flat subs will do the trick.

yes, as long as all the files have undergone no (or the same) scaling then everything should work out fine.

rob
 
  • Like
Reactions: Linwood