3

I recently went on a trip and took a bunch of pics with my girlfriends Canon Rebel.

We shot in RAW, and now I am going to process the RAW images in DarkTable (my first time ever).

I have read that the first thing to do when processing RAW images, is the debayering of them.

I have googled it and read a skimmed a few articles, and I am still a little confused.

So if debayering is required to make a greyscale image a trichromatic image....why are my RAW images already colour?? Does that mean that the camera already did the debayering of the image?

  • 2
    Note that you may not actually need to put a lot of thought into the details of debayering/demosaicing, unless you're taking very sharp photos with a fairly nice lens that will be viewed at that level of detail. For instance, I generally only switch from darktable's default fast PPG algorithm to AMaZE when I'm trying to squeeze as much detail as possible from a macro photo that will be cropped (because I just couldn't fill the frame with that 3mm bug!). – junkyardsparkle Aug 8 '16 at 2:40
9

This is actually really simple: your image is shown in color by Darktable because it renders the preview from the RAW file in order to show it to you — including demosaicing. (Or, depending on settings, it may initially show you a low-quality JPEG preview actually embedded in the RAW file by the camera.)

This is why I find the whole "RAW isn't an image; it's a collection of data!" somewhat over-pedantic. This is true of JPEG files too: "they're not images, they're collections of discrete cosine transforms!" — which is obviously also silly. The difference is that there is no fixed "correct" interpretation of the RAW data: there are many possible ones. Darktable (and any other software) shows a default interpretation when you load the file.

  • Ahh. This is why the default viewer software on Mac seems to look much different than the default viewer (shotwell) on linux. – ScottF Aug 8 '16 at 13:34
  • 1
    @ScottF Yes, absolutely. We have a whole menagerie of questions here asking why the output from some RAW software doesn't look like that from other software. :) – mattdm Aug 8 '16 at 13:36
  • I think most of us who maintain that a raw file isn't an image do it along the same lines as saying a latent negative isn't an image: It isn't a specific image but is rather a set of data that is potentially many different images depending upon how the data is developed and processed. The nice thing (or maybe the curse) about digital raw files is that no irreversible decisions need be made in the process. – Michael C Aug 8 '16 at 18:00
  • adding to what Matt says, in Lightroom and Capture one you could flip between different raw rendering, they are just different ways to show you this collection of data. All of these should be a startup for what you are looking for in your final image. – K'' Aug 10 '16 at 14:26
2

So if debayering is required to make a grayscale image a trichromatic image....why are my RAW images already colour?? Does that mean that the camera already did the debayering of the image?

It might have been the camera. It might have been the application you used to open the file.

When you open a "raw" file on your computer your see one of two different things:

  • A preview jpeg image created by the camera at the time you took the photo. The camera used the settings in effect when you took the picture and appended it to the raw data in the .cr2 file. If you're looking at the image on the back of the camera, it is the jpeg preview you are seeing.

  • A conversion of the raw data by the application you used to open the "raw" file. When you open a 12-bit or 14-bit 'raw' file in your photo application on the computer, what you see on the screen is an 8-bit rendering of the demosaiced raw file, not the actual monochromatic Bayer-filtered 14-bit file. As you change the settings and sliders the 'raw' data is remapped and rendered again in 8 bits per color channel.

Which you see will depend on the settings you have selected for the application with which you open the raw file.

Since you have a Canon camera I would encourage you to also try Canon's Digital Photo Professional for editing and converting raw files. It is included on the software disc that comes with every Canon EOS camera and updates are free from Canon at the support page for your particular camera model. Here's a link to the EOS 700D/Rebel T5i support page. Just click on Software to see a list of the most current versions of the applications available for the particular camera model. You can search for other models from here.

Canon's DPP actually reads all of the EXIF data including the "maker notes" section and by default uses the in-camera settings as the initial profile when rendering .cr2 files (something most raw converters do not do). The initial rendering of the raw data will be very close to the appearance of the jpeg preview generated in camera using the same settings. They will probably be so close that they will be indistinguishable to your eyes.

  • 2
    Specific to darktable: the first batch of thumbnails displayed are, with default settings, the ones embedded in the RAW file, and will be replaced by a rendered version upon any editing action. The demosaic module is one of a few that are "always on", since there's no image data to work with otherwise. It uses PPG method by default, but offers AMaZE, VNG4, and an experimental grayscale option currently. – junkyardsparkle Aug 8 '16 at 2:26
  • Apparently the cr2 format contains no preview jpeg. – ScottF Aug 8 '16 at 13:34
  • @ScottF Every Canon DSLR I've owned (6 different models) produces jpeg previews and includes them in the .cr2 files. – Michael C Aug 8 '16 at 17:47
  • They're not easily accessible without specialized software to extract them from the .cr2, but they are there and most raw conversion software can access them and display them upon opening if so instructed by the display settings one chooses, If you select "fast" over "quality" in the thumbnail preview or quick check modules of Canon's DPP, for instance, you will see the camera generated jpeg preview. – Michael C Aug 8 '16 at 17:56
  • Because Canon's DPP actually reads all of the EXIF data including the "maker notes" section and by default uses the in-camera settings as the initial profile when rendering .cr2 files (something most raw converters do not do) the initial rendering of the raw data will be very close to the appearance of the jpeg preview generated in camera using the same settings. They will be so close that they will probably be indistinguishable to your eyes. – Michael C Aug 8 '16 at 18:07
-1

A bayer pattern looks like this:

[isometric view of bayer pattern]

Each block is a pixel. Not all pixels contain information about each of the RGB channels. Debayering is the process of interpolating the red and green channels of each blue pixel, the blue and red of each green, and the blue and green of each red.

You see raw images as color on the back of the camera screen, in thumbnails and in editing software as a convenience. People don't generally want to look at checkered black and white pictures.

In order to get a raw image into a workable format the following steps must be performed:

  1. raw data readout. Read a bunch of bytes of data into memory.

  2. data conversion. Most uncompressed raw formats store the image as two bytes per pixel, regardless of how many bits of precision the camera actually uses. A 10-bit, 12-bit, 14-bit, or 16-bit bit per pixel camera will all generally produce raw files of the same size in absence of compression. Conversion is the process of normalizing them all so that they appear to be the correct brightness.

  3. color calibration. This is where the primary colors are chosen for the color channels on a CIE color diagram, and to some extent their relative brightnesses.

  4. white balance. This is the second step in adjusting the relative intensity of the color channels.

  5. demosaicing

  6. save or export.

There are additional step for scientific processing, but they are outside the scope of this answer.

  • Your first paragraph is a little simplistic. Adaptive Homogeneity Demosaicing (AHD), which is the most common method used, will also affect the final blue values of the blue filtered pixels, green values of the green filtered pixels, and the red values of the red filtered pixels. – Michael C Aug 8 '16 at 2:06
  • @MichaelClark the specifics of algorithms are not the properties of debayering. It is not a requirement that an algorithm alter the "truthy" pixel values at all. Just copy pasting the values from neighbor pixels is a valid debayering technique. A bad one, but a valid one. – Brandon Dube Aug 8 '16 at 2:10
  • It is also not likely the way the OPs color images he is seeing are being debayered, either. – Michael C Aug 8 '16 at 2:11
  • 2
    This answer is basically like the exact web pages I read already. I will change the title of my question. – ScottF Aug 8 '16 at 2:40
  • 1
    This being open source, we know the algorithm used - the preview is rendered with PPG by default (AMaZE and VNG4 are also options). – mattdm Aug 8 '16 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.