|
|||||||||||||||||||||
Current Texts Comic Imprint Calendar Search PHP-Classes Container-Wizard main.s21 |
|||||||||||||||||||||
Categories
{{login}}
|
Bayer interpolation with imagemagick
Imagine you want to have a little bit more control over the process of developing a digital RAW image, then imagemagick in conjunction with dcraw comes in handy. Following a description how to extract the color pixels of the Bayer Matrix into a separate file:
It is assumed that you have a 12 bit raw file with a RGGB pattern. These can now turned into a full color image: convert -combine <matrix file>_red.png <matrix file>_green1.png <matrix file>_blue.png fullcolor.png If you don't want to just discard one of the green images, you could first average both green files into a new file and use this when combining. You will most likely notice that the image has a strong greenish/cyan tint. This is because a good deal of red is lost due to the IR blocking filter within digital cameras. Using -normalize will scale up all channels and most likely result in a more realistic image, at the price that red is artifically boosted, strengthening noise. Nevertheless, this approach has certain advantages in specific situations: when dealing with pictures taken under monochromatic light (such as Sodiom Low Pressure Lamps) or with an IR pass filter. In both situations, the Bayer pixels get very different information. Under SLP light, blue remains almost dark and has a lot of noise. The situation can even be worse with IR, as it might be that only red is properly saturated. With the Olympus E-510 and a 780nm pass filter, green gets about 50%, blue about 25% of red. It might well be worth considering to trade resolution against a better signal noise ratio and go only for red. VariationsIn the above sample, I apply gamma correction to the matrix file prior to storage. This saves processing time, as it does not need to be applied again on every channel. However, you might to choose to skip gamma correction for whatever reason. AlternativesThis approach is somewhat tiresome if you just want to get a "somewhat RAW" image, that is a color image with no further processing involved, and it surely has the drawback that you loose a lot of resolution in normal circumstances. dcraw -4 -T -r 1 1 1 1 -M -o 0 -S 4095 -k 0 <raw file> Further information about these parameters can be found in raw, dcraw, really raw. Dieser Text ist Teil der Serie Fun with imagemagick imagemagick CommentsPlease note: comments posted won't be visible immediately, as they will be checked for harmful content.
|