The camera's CCD captures photons that encounter the CCD and output them in form of electrons after each exposure. Micro processor behind the CCD reads these electrons, calculates the gray-level of each pixel and therefore re-constructsthe image. But the CCD cannot tell the color, since it does not read the difference of wavelength in the spectrum. Then how do we get color images with our digital cameras? Well, that is how the Bayer-Debayer story begins.
The Imaging Source provides detailed technical white papers to illustrate the fundamental principles of CCD, including Bayer and Debayer mechanisms. They are all available at http://www.theimagingsource.com/publications/whitepapers/.
But on our forum, you can also find useful info on this subject from the users. Gerrit M. Viola just wrote a post there to introduce his article about how to debayer raw images with Maxim DL. You will the article's link in the post for download.
Thank you Gerrit!