Author Topic: How to use raw Bayer CFA master dark & bias to calibrate raw RGB Bayer lights?  (Read 3938 times)

Offline Jason Tackett

  • Newcomer
  • Posts: 44
    • Astrobin Page
Hi everyone,

My master dark and bias calibration frame were generated by subs loaded into PI from my OSC DSLR camera using the raw Bayer CFA format. Lately I have been wanting to try calibrating my light frames using the raw Bayer RGB image format. Should I convert my master calibration frames to Bayer RGB format prior to calibrating (not sure how to do this) or is there a way to tell the ImageCalibration process to treat the raw Bayer CFA master dark as a Bayer RGB image?

Thanks for any advice,
Jason

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
but… both file types represent the same information. why do you need to change?

Offline Jason Tackett

  • Newcomer
  • Posts: 44
    • Astrobin Page
Reading some older posts leads me to believe that using Bayer RGB format causes dark scale factors to be computed separately for each RGB channel which may come in handy with narrowband filters that I am beginning to use (Ha and OIII). I would like to quantify the difference between scale factors.

This also ties in with previous discussions of how flat frames are applied during calibration when using a CLS filter – and my main motivation. My flats, though sufficiently exposed, are not color balanced, so I want to make sure that the R, G, and B channels of my light frames are divided by the normalized flat frame for each channel separately; i.e.,

I’(red) = I(red) * mean(F(red))./F(red)

Here, I(red) contains the red pixels of the light frame and F(red) contains the red pixels of the light frame. Similarly for the other channels (I’m leaving out darks and bias terms in the equation for simplicity).

Please correct me if I misunderstood from the post linked below, but I got the impression that using Bayer RGB format will cause the flat frames to be normalized and applied for each channel separately as in the equation above. Alternately, the Bayer CFA format would normalize the flat frame for all pixels, regardless of color, which is more applicable to single color images.

http://pixinsight.com/forum/index.php?topic=3853.msg26514#msg26514

Thanks,

Jason

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
this could be true - i stopped using an OSC a long time ago and have forgotten most of this stuff.

i think you can sidestep the whole issue by preprocessing everything such that you have 3 mono images. for instance if you make your masters, then run BatchDebayer on all the masters and uncalibrated light subs (using superpixel mode), then use BatchChannelExtraction to get just the R channel for Ha and just the G and B channels for OIII.

then you can treat those masters and the lights as though they came from a mono camera and calibrate each channel separately.

this only works with superpixel debayering and is only technically correct for the R and B channels… the 2 G pixels get averaged together by the superpixel debayering process and so the calibration is not quite correct, but probably close enough.

anyway to your original question, i am not sure it's possible to convert the masters to a different format using any standard process. you can probably write some pixelmath expressions to do it though...

rob

Offline Jason Tackett

  • Newcomer
  • Posts: 44
    • Astrobin Page
Thanks for the suggestion, Rob. Most likely I'll follow the route you are suggesting - probably use SplitCFA on my lights and calibration frames and then treat the RGGB images as single color images for calibration. That should do the trick.

I do want to make sure I understand how to the flat frames are normalized in ImageCalibration for each color channel depending on on CFA or RGB format, but I will start a separate thread with that question specifically to help keep each thread focused on a single question.

Thanks again,
Jason

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
right - i had forgotten about SplitCFA so that avoids the problem with the two G images getting averaged together.

the flat thing is an interesting question - i never thought about how the representation of the data influences the calibration. the tooltip for "Detect CFA" in ImageCalibration only speaks of dark scaling and actually says that Bayer RGB is a requirement for detection, which makes sense. but there's no mention of how flats are scaled in one situation vs. the other.

rob