Page 1 of 1

Develop Canon RAW images into mutliple tiffs

Posted: 2013-05-21T15:23:31-07:00
by waldalla
What is the best way to convert a Canon raw file (CR2) into 2 or 3 differently exposed tiffs for pseudo-HDR/tonmapping?

So, from *one* RAW file I want to get a tiff with +-0EV, +1EV and -1EV. How can I do this via ImageMagick and it raw reader dcraw.

Many thanks, Walter

Re: Develop Canon RAW images into mutliple tiffs

Posted: 2013-05-21T15:37:35-07:00
by snibgo
Can't be done. High Dynamic Range is a technique for taking multiple photographs, at different exposures, and combining them into one.

If you have only one RAW file, you can't create any number of differently exposed images from it.

However, you can create effects that look similar, using "-sigmoidal-contrast", etc.

Re: Develop Canon RAW images into mutliple tiffs

Posted: 2013-05-22T01:29:09-07:00
by waldalla
Ups, I wasn't detailed enough: I know that I cannot use the tiffs for a real HDR, but what I want to get tiffs from the raw file with +-0EV, +1EV and -1EV using all the information available in the raw file, so that I can put them through the same HDR process

Re: Develop Canon RAW images into mutliple tiffs

Posted: 2013-05-22T09:08:08-07:00
by snibgo
I work from Nikon NEF files, rather than Canon CR2, but I doubt that makes any difference. (The following commands are Windows 7 batch scripts.)

You can use IM to convert a CR2 file into something more useful:

Code: Select all

convert in.cr2 out.tiff
IM uses dcraw to read the CR2 file. I prefer to use dcraw directly:

Code: Select all

dcraw %DCRAWNR% -H %hNum% -W -g 1 1 -6 -T -c %DCRAW_PARAM% %RAW_WB% %1.nef >%BASE%.tiff
... where:
%DCRAWNR% is "-n X" where X is a noise reduction depending on the camera and ISO rating;
%hNum% is typically "0";
%DCRAW_PARAM% is typically "-w" to use the in-camera white balance, or %RAW_WB% is a specified white balance.

Then I correct geometric distortion and transverse chromatic aberration, trim off the right edge (because my camera puts weird pixels there), give it a very small unsharp mask, and convert to sRGB.

A single image may have detail in both the shadows (eg vegetation) and highlights (eg sky), with nothing important in the middle. I can increase the contrast at the extremes with "+sigmoidal-contrast". A more extreme effect involves partitioning the image into two separate images: one for the shadows, the other for highlights. Then each is processed, stretching contrast, perhaps to make the lightest parts of the vegetation white while the darkest parts of the clouds become black. These are then merged. I like this when done conservatively, and dislike it when taken to extremes, but each to his own.

Image

Image

If you want to simulate +1EV and -1EV, you might do tests with your camera to see what the actual effects are. Or you might use something very simple*, eg:

Code: Select all

convert in.tiff
( +clone -level 0,90%% -write plus1.tiff -delete )
-level 10%%,100%% minus1.tiff
* EDIT: Do this in sRGB space, not RGB. My Nikon D800 has a 10% shift per stop, except in the toe area where the values are slightly higher. Other camera models will have a different shift.

EDIT 2: Here is that final command again, slightly improved so all the tones shift by 10%.

Code: Select all

convert in.tiff
( +clone -level -10%%,90%% -write plus1.tiff -delete )
-level 10%%,110%% minus1.tiff
I don't know if any of this helps you. Feel free to ask.

Re: Develop Canon RAW images into mutliple tiffs

Posted: 2013-05-23T23:31:08-07:00
by waldalla
Thanks a lot snibgo! This is very detailed and points me exactly in the direction I want to go!

I really like idea of faking the ISO metadata to trick the subsequent tonemapping tool. I'll try it out with Photomatix!