Jump to content


Debayer algorithms - a comparison


Recommended Posts

My image capture/guiding/processing software is AA4, which I have used for some considerable time, and have always found it to work 'hand-in-glove' with my SX OSC cameras.

However, I had access to Maxim DL 4.5, and thought I'd try debayering an image taken with my SXVF-H9C, to see if the debayering algorithms used, produced the same result. In other words, would the colour of my images be the same, irrespective of who's software I used.

Somewhat to my surprise, I found that this was not the case, and different renditions of the basic debayering algorithm, produced different results.

So, who's resulting colour is the correct one, or are none of them correct, and is the resulting colour purely the personal preference of the person writing the the debaying algorithm?. I suspect the latter.

The copy of Maxim that I had access to, had four debaying options; Maxim's own Fast or High Quality, and two of John Winfield's (JW's) 'plug ins', which were blinear, and smooth hue.

My own AA4, has just one option.

Keep in mind, that the test image is just a single 300 sec sub, so the SNR is obviously as would be expected. Howevr, the difference is resulting colour is quite evident.

I found a very marginal difference between Maxim's 'fast' and 'High Quality' options. JW's two plug in produced a result very different from Maxim's own algorithms, in that the sky background, lost its black, and gained a reddish hue.

The AA4 result, which is my personal preference, is different from all the others in the rendition of the nebula colour, while like Maxim's own algorithms, also produced a black sky background. In fact blacker than the Maxim results.

I should add, that all of the images, were subjected to the same level of 'stretch', and no other processing was applied.

As I could only attach four images, I left one of the JW results out, as they were pretty much identical.






Link to comment
Share on other sites

  • Replies 34
  • Created
  • Last Reply

Top Posters In This Topic

Very interesting Dave. The AA debayer produces the most natural colour but I wonder if that is down to the global setting such as offset rather than the accuracy of the algorithm itself. The top 3 are just too red which could be corrected in processing but I would have thought debayering artefacts would be much smaller scale.

Craig Stark has a great article here http://www.stark-labs.com/craig/articles/assets/Debayering_API.pdf

I would like to have access to the Variable number of gradients algorithm since that looks the business.

Link to comment
Share on other sites

Hi centroid, that is very interesting, I don't have any experience of AA4 and minimal experience of maxim DL 4, having said that I have used Deep Sky Stacker which has a number of debayering options, hopefully I can shed a little light on things from my experience.

DSS has 4 debayering options, Bilinear, Adaptive Homogeneity-Directed Interpolation (AHD), Bayer Drizzle and 'Create Super Pixels (no bayer matrix).

I've only ever used the first 2 options, Bilinear was the one I used (Was offered by the program) before I started doing decent long exposure images, as soon as I started doing long exposure 300sec+ images the software started to offer me the AHD option, with its criteria, long exposure and good SNR, having been met. So the SNR could well have a lot to do with which debayer technique you should use.

The last 2 options have never been offered to me for debayering by the software but can be accessed via menu settings. It would appear that the super pixel method acts like binning, and uses 4 adjacent pixels to create 1 'super' pixel, according to the blurb this is useful if you have only a small number of images to stack. The bayer drizzle method is good if you have a large number of light frames and sub 1px guiding accuracy.

From reading the DSS manual a little more I can see that depending on the situation you should use a particular debayer method as one will produce better results over the other, you seem to be correct in thinking that 'none of them are correct' in the way that they handle colour, just some are better than others in a given situation.

From using PHD and a webcam I've seen binning used to reduce noise, which would tally up quite nicely with the 'super pixel' bayer method as this one is used when a small number of light frames are present, this would stand to reason as relatively speaking the SNR should be worse with fewer images (obviously depending on length of exposure).

I couldn't find any mention of the AHD method in the DSS manual other than it exists :( I did a quick google and if you can stand the reading (I couldn't) then you might like to take a look at this link http://www.accidentalmark.com/research/papers/Hirakawa03MNdemosaicICIP.pdf

and a quick look on wikipedia http://en.wikipedia.org/wiki/Demosaicing (no entry for debayering)

I had a quick look at the PDF and wikipedia and it would seem that its dependent on the software used as to what algorithm is used and whether it is a standard algorithm (documented) or in-house algorithm(probably undocumented), might be worth you firing off an email to the program writers and asking what type of method they are using?

Link to comment
Share on other sites


All with all of the deybayer options in Maxim, no offset was required. Selecting any combination of offset, resluted in widly inaccurate colour.

In AA4 a 1 pixel offset in the 'x-plane;, was required. Again, any other combination of offset, or no offset at all, resulted in wildly inaccurate colour.

I just remembered, I also have AIP4WIN 4, which a bought a few years ago, mainly for the book. This came with the software. I didn't really like the program, as I thought it somewhat less than 'user friendly', among other things. So I ceased using it, and moved from AA3 up to AA4. I might however, debayer the same image sub with it, to see what that results.

I sent an e-mail to the 'info' point at CCD Ware, to ask if CCD Stack had a OSC debayering option, but the guy who answered wasn't sure on this, and directed me to the CCD ware forum. Although I'm registered with the Pempro section of their forum, I didn't see the point of registering with the CCD Stack section, just to get an answer to a question :? .

I was very impressed with the video demo/tutorial on CCD Stack, especially the 'live' DDP facility, whereby you can adjust the settings and watch the effect on the image as you do it.

Not tried Nebulosity, but its sounds an interesting prospect.

BTW, thanks for the 'link', an interesting read!!


Link to comment
Share on other sites

Hi Reggie,

Thanks for your input, very interesting.

DSS is one program that I've never used, or seen used, so I'm completely 'in the dark' on its capabilities.

I've always felt that with all of my OSC camera images, that AA4 has given consistently good colour rendition. Especially with the blues and reds, such as in the 'witches broom', while also providing nice black sky background.

I did once download a trial version of Maxim DL 4.something, and this couldn't get the colour anywhere near right, hence I didn't buy. I even raised the issue on the Maxim DL yahoo group, and the only answer I got from the 'man at cyanogen', was that Terry Platt of SX, had provided them with debayer algorithm.

I see that the V4.5, which I was given access to, now has the 'fast' and 'High Quality' options, which while a lot better than the earlier version of the software that I tried, are still not right, as you can see from the above images.

I'm not so sure that any of the software providers, would be prepared to provide details on the maths used in their software.


Link to comment
Share on other sites

Downloaded Nebulosity, and gave that a try.

Unfortunatley, when debayered, or demosaiced as Nebulosity calls it, the entire image is blue, and there doesn't seem to be any means of playing with offsets.

Ah well, it was worth a try.


Link to comment
Share on other sites

Maybe I'm missing something here, Dave but in Maxim DL and I suspect the other programs as well, you have a choice of colour percentages as well as offsets to select. I adjusted the colour percentages a couple of years ago to get the balance I like and have stuck with them and I get the results I want from both by SXV OSC cameras. I also have to select 'Y' offset and by coincidence, this selection also works on both cameras. If I was getting predominantly red images in MaximDL, I'd just wind the red percentage down a bit - surely that is what it is there for?

Link to comment
Share on other sites

Hi Steve,

With the AA4 debayer routine, or 'convert RGB' as its called there, there are no colour percentages to adjust, just offsets in the x or y planes.

With the correct offset selected, AA4 appears to get the colour percentages "right". I assume these are set at 100% each, but as I can't see that, I'm just guessing.

I can understand, perhaps maxim over doing the reds in in the 'object', but why also give a black sky a red tinge :? .

When I get a chance to do so, I'll take the same sub, and 'back off' the red in the debayering process.


Link to comment
Share on other sites

As I said, I don't know what percentages are set in AA4, as there is no adjustment, but I do know that they seem to be correct, both for my H9C, and MX7C before that, whereas clearly, the default settings in Maxim, irrespective of which debayer option is chosen, aren't.

For me, having to adjust the colour percentages used by in the debayer process, is one and the same thing as having to adjust the colour balance after debayering.

Whether its by conicidence that MSB seem to have got them just right for MX cameras, or whether they set them up using an SX camera, is of course an unknown.

If someone cares to send me an un debayered sub from from another OSC camera, I'll be happy to debayer it in AA4, and 'post' the result.


Link to comment
Share on other sites

When I was using a mono SXV H9 I tended to time my subs in a ratio of 1.1 : 1.0 :1.4 RGB. If I used the same sub lengths for each channel I would have to give the blue a big boost in the processing stage. The white balance isn't just affected by the chip but also by the optics and the position of the target in the sky.

With OSC you are going to be affected by whether or not you are using an LP filter. With the QHY8 by good fortune, if you use an IDAS filter the colour comes out pretty close without applying any colour weighting.

Link to comment
Share on other sites

Don't use an LP filter Martin, just an IR 'block', and the samples that I 'posted', were all debayered from the same RAW sub.

Therefore, the colour variation that you see, is 100% down to the debayering algorithm applied.

Another interesting comparison would be CCDsoft. Not sure if I can download a trial version of that. It is possible, as I did this with Pempro (from the same company), and then ended up buying it.


Link to comment
Share on other sites

Ok, here we go with CCDstack, which I was able to download as a 30 day trial.

There are four debayer options for an OSC image here, two for Sony CCD's (GBRG and GRBG matrix), and one each for Kodak and Canon.

The Kodak, Canon and Siny GRBG options produce an all over mono coloured image (orange, blue and turquoise respectively), whereas, either of the Sony options, produce the result as 'posted' here.

The default colour percentages were used, which were 1,1 and 1 for R,G and B.

As you can see, the colours are way out



Link to comment
Share on other sites

Dave, the different products are obviously doing a different job with the debayering but the question in my mind is what is producing the differences. The debayer algorithm should only afffect the border areas so a quick and simple algorithm is likely to produce significant colour fringing around sharp cut offs such as stars whereas more complex debayering should reduce this. I appreciate that you have shown them all with no colour weightings applied but I suspect that AA is doing something in the background. The colour conversion tool is obviously giving better results in AA but I'm not sure it's down to a better algorithm.

That CCD stack image looks like the offset is wrong. With my QHY9 I have to offset both X and Y

Link to comment
Share on other sites

I'm sure the basic debayer algrithms are similar in their maths, but as you say, its likely that AA is doing something else during the debayering process, albeit what, we'll never know. At least with SX OSC camera images, what its doing, suits the images very nicely.

As I said earlier, perhaps MSB set their debayer process up, around an SX OSC camera, and perhaps with an OSC image from a non SX camera, the result would not be as good by default.

Conversely, maybe an alternative OSC image debayered in Maxim, would provide a better default result than it does with an SX OSC image.

What I need is a 'bank' of different OSC cameras, and arange of prcessing packages. Albeit, I'm not doing bad on the software, having AA4, AIP4WIN, CCDstack (trial) here, and access to Maxim.

Roger has got an Atik OSC camera, which I believe also uses the same 285 CCD, as in the H9C. I'll get him to send me a sub, to play with.

It certainly makes for something interesting to do, while all this cloud is about :( , and maybe is of ineterest others on the forum?.

BTW, I can't find any x or y offset options in CCDstack :?


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.