Author Topic: Debayering mystique  (Read 984 times)

Offline jamesRC

  • PixInsight Addict
  • ***
  • Posts: 102
Debayering mystique
« on: 2019 July 16 19:38:40 »
Hi there,

I keep coming back to the topic of debayering. I can't figure it out. My images as downloaded after taking them, are all grayscale fits files. Then where does the color info come from? I see the PostProcessing script uses these same files and produces RGB filess from them, I assume by applying the debayering process along the way. I can't do this with the grayscale images I have. What's up? There is something here that has me mystified. How and when do I apply debayering to my starting grayscale files?

James

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Debayering mystique
« Reply #1 on: 2019 July 16 21:11:31 »
check this link for some understanding of what is going on

http://deepskystacker.free.fr/english/technical.htm#rawdecod

in short, a CCD device is sensitive to wavelengths of light from the ultraviolet to the infrared. in order to produce a color image compatible with human vision, you need filters in front of the sensor to isolate the wavelengths of light that the eye is sensitive to. in a one-shot color camera, there is a permanent set of R,G,G and B filters arranged in the checkerboard pattern you see in the link above. copying only the pixels belonging to a certain filter to one plane of an RGB image is what debayering does.

rob

Offline bulrichl

  • PixInsight Guru
  • ****
  • Posts: 524
Re: Debayering mystique
« Reply #2 on: 2019 July 17 01:23:06 »
James,

please upload one uncalibrated light frame, the MasterDark and the MasterFlat (all as monochrome CFA files, no debayering performed at any phase) to a filehoster and disclose the link here. I guess with these data it can be determined, what the issue is.

Bernd

Offline jamesRC

  • PixInsight Addict
  • ***
  • Posts: 102
Re: Debayering mystique
« Reply #3 on: 2019 July 17 07:00:03 »
I am becoming really confused here.
I try to use Dropbox but for access it needs a specific identifier such as email address, which I don't have for you or for the PixInsight Forum.

What is the issue you are looking for?! I started this thread because I was trying to process my Firefox Galaxy files, subs flats and darks (no bias because my camera is a OSC CMOS). I was trying to do postprocessing one step at a time, as is recommended vs using the postprocessing script. I find that I can NOT apply the debayering process to get a color image, at any point in the process. The starting subs are grayscale and I don't understand why they should be grayscale if I used a OSC camera. Is that the issue you are talking about?

When I use the postprocessing script, the output is the color image I am expecting, but I'll be darned if I know how I got an RGB image from all-grayscale images. There is an option in the postprocessing script to enable debayering, but where and how it's applied, it I  don't know. Am I even making sense with my question?

I feel like there's this deep hole in my understanding, but I don't know if it's bad communications or an overlooked process. My impression (impression, not belief) is that using a OSC camera is much more complicated than using RGB images. I'm not even sure that I am making any sense now. Am I expecting too much from my images??

I expected that using an OSC camera, I could debayer the resulting image at any time along the way, because it has the color info stored in it. That's not what's happening at all. Seems like the issue is that the subs are grayscale, even though they came from an OSC camera. Is that correct??

Sorry about my confusion. It doesn't help ask the right questions.

James.bewildered


Offline dave_galera

  • PixInsight Addict
  • ***
  • Posts: 261
    • QDigital Astro
Re: Debayering mystique
« Reply #4 on: 2019 July 17 07:15:19 »
Have a look at this video, it explains the debayering process
https://www.youtube.com/watch?v=UUx-OM3TWs0

To answer your question all NON-debayered files will appear as greyscale until the they are debayered which effectively adds the RGB to the images, this is all explained in the video.

Dave
« Last Edit: 2019 July 17 07:30:11 by dave_galera »
Dave

Offline jamesRC

  • PixInsight Addict
  • ***
  • Posts: 102
Re: Debayering mystique
« Reply #5 on: 2019 July 17 08:10:05 »
Dave -

Yes it's all explained in that terrific video you directed me to. It had the magic right words in the right order so that I could finally realize what I'm trying to do and why it wasn't working.

Thank you!!

James

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Debayering mystique
« Reply #6 on: 2019 July 17 08:11:26 »
all sensors are monochrome sensors. that's just how CCDs work. as i tried to explain, you need filters to isolate the colors you are interested in. in the case of an OSC, the filters are permanently attached to the sensor, in a 2x2 square pattern, where 1 pixel has a red filter, 1 has a blue filter, and 2 have green filters. this 2x2 square pattern is called a "bayer matrix" after the guy at kodak who invented it.

to produce a 3-plane color image from an OSC camera, you have to debayer. debayering must be done on the calibrated light, which is still in bayer format. if you try to register the subs before debayering, you will destroy the 2x2 matrix and it will be impossible to debayer the image.

the right flow is: calibrate, debayer, register, integrate.

rob

Offline jamesRC

  • PixInsight Addict
  • ***
  • Posts: 102
Re: Debayering mystique
« Reply #7 on: 2019 July 17 10:48:06 »

Thank you, rob.

I did already know about the structure of the Bayer matrix and how it had to be handled to get a color image. What I didn't understand was the particular way, how and with what, this is to be done and why. Dave's video showed me how these things "hook up together" to make colorization happen. Your post here confirms what i have been learning, including that registration destroys the bayer pattern.

I felt really hopeless for a while. Thank you all for your patience, people! :-) :-)  :-)

James.enlightened

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Debayering mystique
« Reply #8 on: 2019 July 17 11:15:41 »
ok - sorry then to rehash but from your initial post it seemed you didn't have a grasp on that...

rob

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: Debayering mystique
« Reply #9 on: 2019 July 19 07:24:52 »
One further thing James,

Even though you follow the pre-processing gudelines that you are now beginning to get to grips with, it is still perfectly possible to end up with a full-colour RGB Image yet, at the same time have either:
a) an image which still, to all intents and purposes, appears to be 'grey'
or,
b) a coloured image where the colours appear to be 'horribly wrong', or where a significant colour cast (often green) still remains

Case (a) is my experience, and I just carry on regardless, eliminating noise and thus increasing SNR as I go. Only towards the end do I start using Curves or PCC to try and extract the colour data that I can tell is present in the image - you can tell you have colour signal present as you can detect (and therefore try to remove) the Chrominance Noise that will otherwise leave you with a poor Chrominance SNR compared to your Luminance data.

There are various ways to eliminate case (b) - just by unlocking the channels and applying an Auto STF can be enough to leave you more confident in believing that you do still have Chrominance data.

Hope this helps.
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: Debayering mystique
« Reply #10 on: 2019 July 19 07:27:42 »
Sorry James - I meant to point out that you can delete a post by clicking on its <XRemove> button
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline jamesRC

  • PixInsight Addict
  • ***
  • Posts: 102
Re: Debayering mystique
« Reply #11 on: 2019 July 20 08:48:24 »
Niall,

Thanks for the "delete a message" tip. It's been done.

Also thanks for the advice that a full color image can look like anything but. I get that most every time, even though I usually use PixelMath. It doesn't seem right that this complicated, careful processing leads to such a dazzling green or yellow image. I'm in the habit of saving an image produced in this way, by using the "WriteJPG" script, so as to get something to work with outside PI. Obviously beginner technique. Obvious beginner. Is there any other user category, in PI?  :P :footinmouth:

James

Offline dave_galera

  • PixInsight Addict
  • ***
  • Posts: 261
    • QDigital Astro
Re: Debayering mystique
« Reply #12 on: 2019 July 20 09:31:20 »
Also thanks for the advice that a full color image can look like anything but. I get that most every time, even though I usually use PixelMath. It doesn't seem right that this complicated, careful processing leads to such a dazzling green or yellow image. I'm in the habit of saving an image produced in this way, by using the "WriteJPG" script, so as to get something to work with outside PI.

James, do a search on the web as there are lots of videos that show you how to sort this problem

Dave
Dave

Offline jamesRC

  • PixInsight Addict
  • ***
  • Posts: 102
Re: Debayering mystique
« Reply #13 on: 2019 July 20 19:24:19 »
DAve,

I guess there are a lot of videos :-) I got this problem, that I can't even hear a Saturn V taking off, so I've got some restrictions on multimedia. This isn't meant as an excuse I just have to work at it more. Again, thank you for the support.

James