Search code examples
dcraw

Output from dcraw has checkerboard shading


I'm trying to use dcraw on a color image (e.g.CR or NEF) to extract raw monochrome data for image processing.

With parameters -4 -D -c I get an image with a checkerboard as shown below:

Checkboard on image

When unzoomed, the image data is correct, except for the checkboard pattern in all images from different cameras.

The above image was produced using -T and zooming in the resulting .tiff file in File Viewer Plus. In practice, I'm reading the .pgm file directly and getting the same checkboard.

What aren't I understanding? Does this have something to do with Bayer filtering?


Solution

  • Yes, this is due to Bayer filtering and no demosaicing. For example, Green areas will have green pixels brighter than red according to the Bayer pattern, whereas red areas will have green pixels dark. To get some kind of correct grayscale (or color) image, intensity has to be weighed over a 2x2 area (in standard Bayer). What you are looking for cannot be achieved without the demosaicing step. Your best bet is to extract a color image, then turn it into grayscale.