I’m photographing paintings, with natural light. My approach is to take 3 photos per painting:
- with a colorchecker card in front
- with a white card in front (covering the entire painting)
- the painting itself
(using a Lumix S1R, ideally with high resolution mode for step 3 only, but if necessary for all 3)
This results in, say, colorchecker.rw2, whitecard.rw2 and painting.rw2.
I hoped to do all postprocessing in lightroom, but can’t get the flat field correction to work there. So I was pointed to dcamprof. So I’m trying to do the flat field correction using that (and potentially the color correction, but that I can do in lightroom as well).
I’ve been trying
dcamprof testchart-ff whitecard.tiff painting.tiff corrected.tiff, but it comes out nearly completely black. I suspect it may be due to how I converted the raw files to tiff, as the documentation says “If you are correcting a TIFF file the input files must be 16 bit in linear gamma.”
Is that the issue? And if so, how do I convert from .rw2 to the right tiff files? (with a command line tool preferably)
I’ve tried libtiff’s raw2tiff, but haven’t been able to get anything sensible out of that. I’ve also tried
sips -s format tiff whitecard.rw2, and I have tried exporting to tif in lightroom, where I can select 16 bit but I don’t see any option for linear gamma. The last two options don’t destroy the image, but as mentioned, using them in
dcamprof just creates a black image.
Hi (Morrn? Davs?) @Aron_Jansen, and welcome!
I do not know a thing about dcamprof — but since
you mentioned RawTherapee in the post header
I wonder whether you have read how RT handles
flat-field correction?? Flat-Field - RawPedia
Re your planned shooting sequence: what about adding
a shot of a grey card as well, to pinpoint exposure?
Claes in Lund, Sweden
I don’t know the specific code of testchart-ff, but the intent is to flat-field-correct shots of color-patch reference targets. There might be logic specific to that sort of distribution of color.
+1 to what @Claes said, RawTherapee’s flat-field correction is targeted to your specific use case.
@Claes I tried that as well, but I keep getting reddish stripy noise, I must be doing something wrong but no idea what, I’ll have to look into it more. I’ll have to do this close to 200 times though, that’s why I prefer a command line program.
On the shooting sequence, I do have a grey card as well, in the same shot as the color checker.
RawTherapee has a command line interface.
Just to make sure: For Lightroom flat-fielding, you need to take care that the white card covers the complete image frame, so not just cover the painting and leave some border around it.
@geni1105 Yes exactly, which is impossible to achieve out of camera, not only do you need to line it up perfectly, but also the aspect ratio of the camera must match that of the sensor. It’s a very annoying restriction, I’ve tried to contact Adobe about it but without success.
I did find a silly workaround after reading your comment: crop the raw file, that is not enough to pass this criterion you mention, but if you then export as tif, and reimport, it does work…
@ggbutcher Why do you say that RawTherapee’s flat-field correction is targeted to my specific use case? In the documentation it’s also all about correcting for various lense distortions, rather than uneven lighting.
@paperdigits Thanks, didn’t know that. I’m having trouble with it though. I’m on a Mac, and in the installation instructions here it says to move rawtherapee-cli into $PATH, but there is no rawtherapee-cli in the file…
A bit of negative logic, dcamprof is not targeted to your use case, RT flat field is. However, I can see why you’d try dcamprof, ‘flat field’ should just be ‘flat field’.
I’d like to chase this in dcamprof, but I’m lips-deep in another project right now…
Not sure if I understand, I would assume that you place a cardboard right in front of the painting, and use a large enough one such that it covers the camera’s full image frame?
Why would you need to crop anything then?
@geni1105 I may try that, but it is very cumbersome to do that exactly, so that not even a sliver is uncovered. There are nearly 200 paintings of about 100 different dimensions. Even this workaround I mentioned above will be way faster than doing this exactly right. I don’t mind the loss of a few pixels if say only 90% of the frame is occupied by the painting (in fact this is unavoidable unless the aspect ratio of the painting matches the sensor, which is not the case), as long as this intermediate conversion to a cropped tif doesn’t reduce the image quality (after applying the correction in Lightroom, which yields a dng, some more manual editing in lightroom, and exporting to jpeg).
Also for the larger paintings, I have a whitecard that covers them completely, but wouldn’t be big enough to cover the whole frame of the camera. I haven’t found anything bigger than that. (something like 150x180cm, don’t have the measurements here)
DIY - join them yourself… seams you can remove in raw file ( raw → DNG and then just modify sensel data to remove seams if they affect anything in it and save back to DNG … )
dcamprof ( or lumariver PD or etc ) does flatfielding for target shots when they are creating camera profiles … this is not what you apparently try to achieve ( but you need to flat field your CC target if you creating camera profile in dcamprof ) , so in a normal scenario you need to flatfield target shot ( and colorchecker is NOT ENOUGH to create repro quality profiles ) and then create FFC for painting shot = Flat-Field Correction if you are capable to program you can do FFC yourself in Matlab/Octave or anything else that read/write DNG files
something like this ( excuse any spelling errors )
h_DNG_FlatFieldShot = Tiff( … , ‘r’ );
v_OffsetsDNG_FlatFieldShot = getTag( h_DNG_FlatFieldShot , ‘SubIFD’ );
setSubDirectory( h_DNG_FlatFieldShott, v_OffsetsDNG_FlatFieldSho( 1 ) );
m_ImageData_FlatFieldShot = h_DNG_FlatFieldShot.read();
close( h_DNG_FlatFieldShot );
h_DNG_Painting = Tiff( … , ‘r+’ );
v_OffsetsDNG_Painting = getTag( h_DNG_Painting , ‘SubIFD’ );
setSubDirectory(h_DNG_Painting, v_OffsetsDNG_Painting( 1 ) );
m_ImageData_Painting = h_DNG_Painting.read();
% manipulate as you wish, flat-field, etc do some math
h_DNG_Painting.write( m_ImageData_Painting );
close( h_DNG_Painting );