I've taken pictures of documents recently. While in my case there was no requirement to have high quality pictures, I decided to try to aim for the most detailed and noise free pictures possible. To get the most detail, you should use the largest focal length available and take pictures from as close as possible, but such that you can still focus on the document. The F-number should be chosen somewhere between 6 and 8, this is where the lens will be the sharpest. Also, you may get distortions at the edges of the picture and this will be less of a problem if you shoot at F/7 instead of F/2.8.
In my case, I put my camera on a tripod with the legs fully retracted which puts the camera about 60 cm above the document. The focal length I used was 50 mm. Then, I first took a picture of a white paper to set the white balance. I then took one picture of the document to get the exposure right (with ISO set at the lowest setting, 100 in my case). You want to "expose to the right", so you check the histogram adjust the exposure to expose for longer but such that you don't get overexposed parts.
Then I started to take pictures with the remote control and manual focus where I focused on a few different parts of the page. And for each focus setting I took 5 pictures. Noise reduction was set to the lowest setting. Then when I was done taking all the pictures of all the pages in this way I downloaded the raw files to my computer and used the raw converter to generate 16 bit TIFF files, here the noise reduction was set to off. I aligned each set of 5 pictures and averaged over them to get rid of the noise. This prevents the loss of detail. Then the averaged pictures for the different focus settings were aligned and a focus stacking was performed.
The alignment of the 5 pictures was done using the align_image_stack
program which is part of the free of charge Hugin panorama stitcher. After installing, you can just put a few copies of the program align_image_stack.exe
in a few directories. Then in one of these directories you can open a command prompt and give the command:
align_image_stack -a al -C -t 0.3 -c 20 image1.tif image2.tif image3.tif image4.tif image5.tif
Here the -a al
defines "al" as the prefix for the remapped images; -C
means that these images will be cropped to the same size; -t 0.3
sets the tolerance for misalignment of the control points to be less than 0.3 pixels; -c 20
sets the number of control points to be 20 in the different segments that the program uses (in practice this means that you'll end up with many hundreds of control points).
The output is are then TIFF files named al0000.tif
, al0001.tif
, etc.
The next step is to average over these 5 images. I use the ImageMagick program for that. You can give the command:
convert al*.tif -poly "0.2,1,0.2,1,0.2,1,0.2,1,0.2,1" av.tif
Here the -poly
command evaluates a polynomial, the 0.2
's are the weights of each of the pictures, the 1
's are the powers that obviously need to be set equal to 1 here.
The average of the pictures is then contained in the file av.tif
, and this will be an extremely low noise picture.
Then aligning the different pictures for different focus settings must be done differently. First you must crop all the different averages to the same size, otherwise the align_image_stack
program will give an error message. The command you then give is as follows:
align_image_stack -a al -t 0.3 -c 20 -m -z av2.tif av3.tif av4.tif av5.tif av6.tif av7.tif av8.tif ...
So, you now don't have the -C
option, because we don't need to crop the remapped images to the same size. The -m
option will optimize for the field of view of the images, this is necessary because of the different focus setting. The -z
option will optimize for the distance of the camera to the object, this option may also be necessary to get good alignment.
Then you use the enfuse program that also comes as part of the Hugin program to process the focus stack. Move the aligned averaged files to some directory where you also put a copy of the enfuse program. There you open a command prompt and give the command:
enfuse --exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask *.tif
The output will be a file named a.tif
To save time with running the align_image_stack
program, you can open multiple command prompts and process many sets simultaneously. On a 4 core processor you can run 4 instances of the program and speed up things by a factor of 4.
I was very satisfied with the results, the pictures were extremely sharp without any noise. The extremely small delicate details were visible just as well as on the original when using a magnifying glass.
To conclude, let me summarize the essential points:
- Take pictures from up close using a tripod and remote control. Use a long focal length to capture as much detail as possible.
- Use the optimal F-number for lens sharpness (typically somewhere between F/6 to F/8), do not increase the F-number beyond this range to try to get the entire document in focus, as that would decrease the sharpness due to diffraction. Instead use focus stacking.
- Use the lowest ISO setting, use the lowest noise reduction setting, but do enable long exposure noise reduction. The latter option lets the camera do a dark frame subtraction which eliminates the effect of hot pixels.
- Expose to the right and take multiple pictures. An exposure compensation of 2 stops and taking 5 pictures means that you'll capture 20 times as much light, as a result the noise can then be reduced by a factor of sqrt(20), about 4.5 times by averaging.
- Process the pictures as described above. Make sure the noise reduction in the raw processor is off.