inverting photos of color negatives with darktable

So, unless we know in advance the film density of the negative we’re digitizing, DMAX shouldn’t be touched, right?

Same as usual, Dmax is bounded by the abilities of your film emulsion (that’s your max) but a particular capture could use only part of these abilities, and also, it depends on how the scanner has anchored the exposure.

The default Dmax (2.05) corresponds to modern colour emulsions, for B&W you could go as high as 3.8. At this point, I don’t know if it’s better to set Dmax to the film theoritical value, then adjust the contrast on the print parameters at the end (since everything is highly non-linear, it might be good to use the right pivot during the inversion), or if you can simply adjust the Dmax straight from the beginning to account for your image dynamic range.

1 Like

While the color pickers don’t arrive, I’m using the following procedure in trying to get a more precise film setup.
The procedure starts with a negative exposure that contains some unexposed part.
After applying white balance on the exposed part of the negative, I go to color picker and select an area on the unexposed part:

Then I use the R, G and B values to calculate the percentage of each channel relative to 255:

image

Then, in negadoctor, I apply these values on the film Dmin section. This gives me a good starting point:

So far, so good.

1 Like

hello geeks, the colour pickers (white balance and film colours) are pushed on the branch :slight_smile:

I’m considering adding other pickers for Dmax (max RGB, same as filmic) and inversion offset (min RGB, same as filmic), then the OpenCL code should take me 30 min of work, and it will be ready to go.

This is the white-balanced polar bear:

10 Likes

Looks great.

You (kind of) asked for it, so here’s the challenge :wink:: If we only could make use of the alpha channel that has the information about scratches and dust from an infrared scan directly in darktable … (find my musings about this topic here: Scanned image scratch removal with “ICE”)

That would require to modify the TIFF reading library in dt to map the 4th channel of the image to some mask buffer, then to wire the mask to some sort of inpainting algo. I have thought about it (you bet), I have some (half-working) inpainting code in image doctor, so once I get image doctor to work properly (probably at least 3 months of work), it will be feasible.

This module started as a joke, while drinking beers, with a friend who happens to scan a lot of negatives these days and be quite unpleased with the results. It took 4.5 hours to get the whole prototype to work, then 3 days to test and debug.

3 Likes

@anon41087856 not sure if this means something:

[ 93%] Building C object src/imageio/format/CMakeFiles/tiff.dir/tiff.c.o
In file included from /home/gustavo/darktable/build/src/iop/introspection_negadoctor.c:5:0:
/home/gustavo/darktable/src/iop/negadoctor.c: In function ‘process’:
/home/gustavo/darktable/src/iop/negadoctor.c:243:6: note: The ABI for passing parameters with 64-byte alignment has changed in GCC 4.6
 void process(struct dt_iop_module_t *const self, dt_dev_pixelpipe_iop_t *const piece,
      ^~~~~~~
[ 93%] Linking C shared module libhighpass.so

Aren’t these the best ideas :grin:

As scanning of 1 film takes approx 2 hours, 1 slide magazine approx. 4 hours, digitizing the remaining material will take another half a year. So Christmas 2020 would be sufficient for the release of this feature :wink:. But seriously, thanks for what you already implemented, this looks amazing. I have to get a new computer to be able to compile darktable again and test your code …

1 Like

Here’s an attempt to an edit with negacolor. I found this one particularly difficult, not sure if I messed something while capturing the negative, but there is this strong color cast at the bottom corners that I could not get rid of. Other images from the same negative strip don’t present this issue. Now thinking about it, could this be the camera vignetting, since this is the only image where I’ve pushed the darks this much? In the negative, these corners lie on the brightest areas of the negative, so vignetting may be noticeable.


IMG_7291.cr2.xmp (21.0 K B)
IMG_7291.cr2 (11.5 MB)

The image I used to set up negacolor film properties tab and then copy to the image above as a starting point, and corresponding xmp:
IMG_7286.cr2 (11.8 MB)
IMG_7286.cr2.xmp (8.7 KB)

EDIT: Anyway, the color pickers are a great add on, thanks!
These images are licenced by CC-NC

1 Like

There is something deeply messed up with this negative. The foreground seems harshly underexposed, then you have 2 WB plus light leaks or developer stains on the sides. I had to use the color balance to take care of the 2 WB. Also, I have no clue what the camera scanning light WB was, but you should fix it first.

IMG_7291.cr2.xmp (18,3 Ko)

This photo would be great for a playraw :slight_smile:

I think it’s possible to rescue it with a lot of curves

IMG_7291.pfi (49.7 KB)

1 Like

I just pushed a change that adds 5 more color pickers (Dmax, inversion offset, density, exposure and a second WB), and added a second white balance term (for shadows) intended to correct color casts in addition of illuminants.

If using the auto-tuners/color pickers to speed-up your edits, please use them in the UI order (from left tab to right tab, from top to bottom inside the tabs).

I will check the maths in the auto settings of the color pickers tomorrow, I’m pretty sure I messed up at least one of them.

2 Likes

Nice job, @age and @anon41087856!

If you think so, let’s go then.

The OpenCL kernel is available. Also I have fixed a big mistake in my optimized log10 function (expect your edits to not produce the same result).

Thank you.
I’ll do my best to do some more tests, but I’m very short of time now due to personal problems, so I probably won’t be available for the next days.

Module finished and ready for testing:

6 Likes

Exzellent video, as usual :+1:.

@anon41087856, thanks for the video and the work on the module.
Here’s one more raw, this time, a breeze to edit.


IMG_7297.cr2.xmp (5.8 KB)
IMG_7297.cr2 (11.3 MB)
This file is licensed Creative Commons, By-Attribution, Share-Alike.

I used in-camera custom WB, so, since there are no clues in the image from the illuminant, here are the settings:
image

EDIT: The film is a Kodak Gold 100-2

As a friend is going to lend me a nikon ES2 film adapter, I am exercising on negative inversion.
I am doing trials with ART and I could not stop to post my @gadolf photo processing.

I modified the WB to avoid what I see as a purple cast.

1 Like