Author Topic: Is debayering necessary?  (Read 8652 times)

Offline chrisvdberge

  • PixInsight Addict
  • ***
  • Posts: 104
Is debayering necessary?
« on: 2013 September 11 05:20:31 »
I'm a bit confused on debayering. I use a Nikon DSLR (D7000) and at first I debayered the raw files using the Batch Debayer script in PI.
But it seems that aligning and stacking the raw files directly in PI seem to work perfectly fine. I still see 'debayer' as the first step in all the workflows I read. Am I missing something or is it different for Nikon RAW? Or am I right and does PI handle the files just fine?

An example of a recent processed image as reference;
NGC7331 + Stephan's quintet (click for full size)

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Is debayering necessary?
« Reply #1 on: 2013 September 11 09:06:14 »
debayering is (always) necessary to turn the greyscale sensor image into a color RGB image.

if you use the BPP script and "osc" is ticked, debayering is going to happen automatically during the flow. you just need to be sure the proper bayer pattern is selected.

if you are doing the calibration and stacking by hand, then you need to debayer the subs after calibration and before registration.

rob

Offline TobiasLindemann

  • PixInsight Addict
  • ***
  • Posts: 126
    • Trackingstation
Re: Is debayering necessary?
« Reply #2 on: 2013 September 11 10:30:37 »
You are right that PI can align and stack monochrome raw files as well. The problem is to debayer the images after aligning, because the pixels are not the the same place as before aligning. So the bayer-matrix affects the wrong pixels.

Offline chrisvdberge

  • PixInsight Addict
  • ***
  • Posts: 104
Re: Is debayering necessary?
« Reply #3 on: 2013 September 11 11:46:35 »
This makes me wonder; How am I getting the good results (in terms of color/signal) as posted above?
I've read something about an 'embedded JPG within the NEF file'. Could it be that I'm actually ignoring the raw data and working with the embedded JPG's if I don't debayer?
 :surprised: :o

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Is debayering necessary?
« Reply #4 on: 2013 September 11 15:09:32 »
well, are you using the BPP script or doing it by hand?

if using BPP the right thing is likely happening behind the scenes.

CR2 files also have lots of embedded .tiffs and .jpgs and i don't think DCRAW pays attention to those. of course, i don't know anything about nikon raw files and how DCRAW treats them...

rov

Offline chrisvdberge

  • PixInsight Addict
  • ***
  • Posts: 104
Re: Is debayering necessary?
« Reply #5 on: 2013 September 11 23:35:18 »
I'm not sure what you mean by the BPP script.
I just use StarAlignment and ImageIntegration.

One thing I noticed in the Process Console is that PI seems to debayer the file on opening.
Code: [Select]
Timestamp: Mon Sep  9 01:56:47 2013
Camera: NIKON D7000
Owner:                                     
ISO speed: 1600
Shutter: 300.3 sec
Aperture: f/0.0
Focal length: 0.0 mm
Embedded ICC profile: no
Number of raw images: 1
Thumb size:  4928 x 3264
Full size:   4992 x 3280
Image size:  4948 x 3280
Output size: 4948 x 3280
Raw colors: 3
Filter pattern: RGGBRGGBRGGBRGGB
Daylight multipliers: 2.098821 0.925441 1.126505
Camera multipliers: 506.000000 256.000000 365.000000 256.000000

Invoking: dcraw -w -q 0 -t 0 -o 0 -4
Decoding NIKON D7000 file (4948x3280 pixels, ISO=1600, Exposure=300.30s): done
Loading raw image: done

Not sure it does this also on opening the files for aligment and stacking?
 

Offline naavis

  • Member
  • *
  • Posts: 66
Re: Is debayering necessary?
« Reply #6 on: 2013 September 12 00:12:31 »
I think you need to tweak the format settings in the Format Explorer to make PI open the raw files as monochrome instead of debayering them immediately.
Samuli Vuorinen

Offline chrisvdberge

  • PixInsight Addict
  • ***
  • Posts: 104
Re: Is debayering necessary?
« Reply #7 on: 2013 September 12 01:13:57 »
Both grayscale and rgb-color are set to 'true'. But isn't this convenient? Any reason to debayer it seperately if PI can do it in the process as well appartently?

Offline chris.bailey

  • PixInsight Addict
  • ***
  • Posts: 235
Re: Is debayering necessary?
« Reply #8 on: 2013 September 12 07:45:32 »
If you are going to calibrate those frames before stacking them you will want them as RAW undebayered fits as calibration should be carried out on non debayered frames.

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Is debayering necessary?
« Reply #9 on: 2013 September 12 09:04:19 »
yes chris.bailey and naavis are correct, for proper calibration the images have to be opened as raw monochrome files. debayering does pixel interpolation which invents data for the missing pixels of each color, making correct calibration impossible. your calibration frames need to be opened as raw files as well.

a manual flow would be:

BatchFormatConversion of bias sub frames (in raw mode), then integrate the .fits of the bias frames with no weighting ---> masterBias.

ImageCalibration of dark sub frames with masterBias only (this converts them to .fits as a side effect)
ImageIntegration of calibrated dark subs, no weighting, use pixel rejection to get rid of cosmic ray hits. carefully study rejection maps. --> masterDark_c

ImageCalibration of flat sub frames with masterBias only (if flat exposures are short enough)
ImageIntegration of calibrated flat frames (see vicent's flat frame tutorial for hints about how to integrate) --> masterFlat_c

ImageCalibration of light subs with masterBias, masterDark_c, masterFlat_c. since the master dark and flat are already calibrated, do not check "calibrate" under the master dark and master flat sections. the masterDark_c can be optimized (scaled) if necessary.

ImageIntegration of light subs.

the flow is (raw) open, calibrate, debayer (->rgb) star alignment, integration.

given all that stuff above, you can see why the BatchPreProcessing script was invented. for mono cameras, the flats have to be done 4 or more times depending on how many filters you have used. on the other hand, depending on how quickly dust motes move around on your sensor (and how fast your optics are), you may be able to get away with the same flats for a while. with my f/2.8 lens i can not see any dust motes in the flats and so they are good for a long time. at f/8 with my telescope, it's a different story. i need new flats for every night's work.

rob

Offline topboxman

  • PixInsight Addict
  • ***
  • Posts: 292
    • Peter's Gallery
Re: Is debayering necessary?
« Reply #10 on: 2013 September 12 09:24:26 »
Hi pfile,

Thanks for the work flow. I am going to try that. I have been unsuccessful calibrating flats using PixInsight's calibration tutorial by using "Calibration" checked in Master Bias and Master Dark sections of Image Calibration. I was simply trying to use a short cut method but it's not helping me. I know BPP is available but I want to get PixInsight Image Calibration working so I can understand the tool better.

Peter

Offline chrisvdberge

  • PixInsight Addict
  • ***
  • Posts: 104
Re: Is debayering necessary?
« Reply #11 on: 2013 September 13 08:34:26 »
Thx for the info, Will use this workflow once i start using flats.
Right now im just using lights, so think thats why i was succesful without debayering. (Using dslr and using darks when temperature isnt controlled only ads noise in my experience)

Offline ssavignac

  • Newcomer
  • Posts: 13
Re: Is debayering necessary?
« Reply #12 on: 2013 October 22 11:59:47 »
Hello,

Beautifull picture,

Just curious to know how many picture you take and ISO setting.

Samy