Author Topic: newbie struggle with debayer  (Read 3355 times)

Offline slackingCamel

  • Newcomer
  • Posts: 21
newbie struggle with debayer
« on: 2017 August 28 10:06:31 »
hi all

I'm struggling to debayer images correctly from my sony alpha 6k.
i know its RGBG pattern, but i get funny results when running the process.
attached a screenie of the source image and each result the demosaic method creates.
any settings that i can try? or should i preprocess or postprocess to balance the color?


Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: newbie struggle with debayer
« Reply #1 on: 2017 August 28 10:24:20 »
when you do the STF on these images, were the channels unlocked?

a green cast is normal when the channels are locked, try unlocking them and see which one looks right

rob

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: newbie struggle with debayer
« Reply #2 on: 2017 August 28 11:21:53 »
I found a A6000 sample raw(,arw) file on the web and when I loaded it in PI it came back as RGGB. Here is that sample opened as pure raw and then debayered. The green tinted image is STF Linked and the Normal is STF Unlinked as rob was saying.


Mike

Offline slackingCamel

  • Newcomer
  • Posts: 21
Re: newbie struggle with debayer
« Reply #3 on: 2017 August 28 12:10:43 »
thx mike. that got me the right colors.

somehow this url... and others i found said RGBG.
http://www.imaging-resource.com/PRODS/sony-a6000/sony-a6000DAT.HTM

Offline msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: newbie struggle with debayer
« Reply #4 on: 2017 August 28 13:11:14 »
Glad your colors are correct. The internet is full of repeated incorrect information unfortunately.


Mike

Offline slackingCamel

  • Newcomer
  • Posts: 21
Re: newbie struggle with debayer
« Reply #5 on: 2017 August 29 07:04:31 »
almost correct, so now i have this green spike in the histogram, how do i bring the colors in line to get the original?
i used the sony software to create a tiff that shows the true color i'm expecting. (in the insert)
i do expect that in PI this can be done quite elegantly.

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: newbie struggle with debayer
« Reply #6 on: 2017 August 29 08:23:31 »
Whenever you are discussing the layout of the ColourFilterArray (the CFA) with respect to Bayering or DeBayering images (on any kind of OSC camera) it is essential that there is a full understanding, and declaration, of 'where' the origin of the CFA lies, and in which directions the X and Y axes lie.

Think of ot like this:
  • The manufacturer of the sensor creates an array of photo-sensitive pixels
  • These pixels are not 'colour-sensitive' - they are just 'photon-sensitive
  • To make a particular pixel sensitive to a particular colour, a 'filter' is added
  • This 'grid' of different coloured filters is then the CFA
  • The CFA grid will have some form of repeating pattern, to cover the whole sensor
  • CFA colurs can have three colours (Rd, Gn, Bu), or four (Cy, Mg, Ye, Gn), and others
  • The most common CFA grids nowadays tend to have three coloured filters (RGB)
  • But, the pixel grid of sensor sites is 'rectangular', and so a four-filter CFA is required
  • Because the human eye is most sensitive to Gn, and extra Gn filter is used
  • The CFA is now a four-filter, rectangular, 'super-pixel', yet still only uses three colours
  • But, with three-filter, 2x2 array- there are still quite a few CFA possibilities
  • The sensor manufacturer will select what they believe to be their preferred CFA layout
  • They will also define which sensor pixel is the origin - i.e. at (X, Y) = (0, 0)
  • They will also define the 'positive' direction for both the X and the Y axes
  • Having defined the origin and the CFA, it is then possible to identify all other pixels
  • However, now the manufacturer of the imager becomes involved
  • The CCD might not be used in the same 'orientation' in a given imager
  • The X-axis and Y-axis may be swapped, turning 'landscape' mode into 'portrait', for example
  • A 'positive' axis direction may actually be processed by the CCD firmware as 'negative'
  • Sensor pixels at the image edges can, and are often, 'ignored' - or 'blacked out'
  • These 'black' pixels are/can be used as a 'zero reference' in some instances
  • However, any such 'black edges' need to be taken into account as 'CFA Offsets'
  • The user is then at the whim of the image acquisition software
  • X- and Y-axis 'flips' and 'flops' and black-edge offsets can be, and are, totally ignored
  • They can also be completely, or partially, 'reversed' by the image acquisition software
  • Most importantly, some, all, or none of this critical information will necessarily be available
  • . . . and so on . . .

And so, unfortunately, it is often left to the user to determine - emprically, i.e. by trial and error - what settings are actually needed. At least PixInsight has set out to provide the user with the widest range of tools possible to identify what settings should be used.

I always recommend that a user takes an image of a purely (or, at least 'predominantly') Red scene - and then repeats this for a Green and a Blue scene. Then, each of the images is examined, individually, at a very high zoom factor, concentrating on what PixInsight uses (and displays) as the Origin (X=0, Y=0) - as well as the three neighbouring pixels at (1, 0), (0 1) and (1, 1) - one pixel to the right, one pixel down, and one pixel 'to the right and down' respectively.

The examination should identify the brightest pixel - of the Red scene, the brightest pixel of the Blue scene, and the two brightest pixels fo the Green scene. The CFA grid is then named - in the order of the four pixel positions described in the preceding paragraph - according to brightness of the pixel found during the examination.

So, if (0, 0) was brightest in the Red scene, and (1, 1) was brightest in the Blue scene, and (0, 1) & (1, 0) were brightest in the Green scene, the 'name' for the CFA layout would be RGGB (double-click, or select, to reveal).

I hope that helps - but I am happy to explain things further if I have missed anything, made a mistake, or otherwise confused anyone  :)
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 slackingCamel

  • Newcomer
  • Posts: 21
Re: newbie struggle with debayer
« Reply #7 on: 2017 August 29 10:09:36 »
it does help me detect the pattern.
my best color match came from bilenear method, but i'm still left with 2x the green light as i am with red and blue... correct?
due to the camera having twice the green pixels, so how do i rebalance it, and when should i be doing this, at the beginning of the preprocess or at the end?

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: newbie struggle with debayer
« Reply #8 on: 2017 August 29 14:33:22 »
Stick with Bi-Linear for just now, until you get a better hand;e on things.

Yes, you will have twice the number of green-filtered pixel sensors working for you in the camera - but that issue is catered for in the DeBayer process.

Once you eventually have a fully pre-processed "MasterLight" you may well find all sorts of colour-cast issues. Don't worry about this - it is normal. Your initial post-processing steps should help to 'neutralise' colour-cast issues, but you may still feel concerned that you are working with a de-saturated colour image. Again, this is perfectly normal, and subsequent steps, as you will learn, will gradually tease out those colours that you believe should be present in your image.

There is a lot more 'finesse' involved in using PixInsight but the results are well worth the effort. Sure you can use other packages to beat the devil out of your data - but, if you just want pretty-coloured pictures, a seven year-old child and a box of wax crayons is really all you need  :laugh:
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 slackingCamel

  • Newcomer
  • Posts: 21
Re: newbie struggle with debayer
« Reply #9 on: 2017 August 30 04:07:12 »
ok thanks for that, so its post processing. and this is normal.
and i am enjoying PI greatly.
i can see that this tool is precise and complex, that requires investment and am already seeing good results.
there is a lot of theory i need to get into, lack of knowledge is my main hindrance at this point.

thanks for your help.


Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: newbie struggle with debayer
« Reply #10 on: 2017 August 30 05:15:53 »
Just remember that we are all learning here, some of us may have had the time and opportunity to learn 'more', but none of us can ever claim to have learned 'enough' !

Keep persevering and feel free to ask as many questions here as you want - hopefully you will get an answer most of the time.
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 msmythers

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1178
    • astrobin
Re: newbie struggle with debayer
« Reply #11 on: 2017 August 30 07:47:13 »
And when you get old enough you can have the pleasure relearning tools that you knew last week, haha. Now if I could just remember where I put those notes :-\


Mike

Offline slackingCamel

  • Newcomer
  • Posts: 21
Re: newbie struggle with debayer
« Reply #12 on: 2017 August 30 23:29:39 »
its been a great learning experience, and i'm not sure i can replicate the result, but i got something reasonable. (and the best Ive done in 2 years of amatuering)

only a 5 frame stack, calibrated, with very basic post processing (more like post guessing).

but its like the story of Japanese chicken sexing... keep at it , till its automatic u dont have to "know" it.