High resolution film transparency digitalization using macro lens and stitching
Say you have a bunch of medium format film negatives or transparencies you want to digitize. What are your options?
Flatbed scanners are poor - always out of focus, the best consumer scanners only yield around 2300 ppi real resolution (even if scanning at 6400 or more!) and dynamic range is often poor (=crushed noisy shadows). Dedicated tabletop film scanners are much better but for medium format they are hard to come by these days and are quite expensive. They usually scan at 3000 - 3200 ppi and unlike flatbed scanners they deliver the resolution, and usually have better dynamic range. The best is still drum scanning but these are becoming even harder to come by and of course extremely expensive to buy new. There are still some drume scanning services around, so if you want the best possible you should probably go for that, but it will cost.
So what about using a macro lens, a digital 35mm camera and a light table? Equipment you may already own. Yes - it is possible and if done correctly you get very good results, much better than flatbeds and on par or even exceeding dedicated tabletop film scanners.
This method is also applicable to 35mm film transparencies, but since 35mm tabletop film scanners are relatively cheap and often good quality that can be a more practical alternative. Still I do use macro lens digitalization for 35mm, to get that little extra in resolution and dynamic range (HDR) and cover 100% of the film frame (film scanners usually crop the borders some).
I recommend a 12+ megapixel APS-C camera for 35mm transparencies and a 20+ megapixel full-frame camera for medium format. At 1:1 macro distance (near limit for most macro lenses) the lens covers the same area as the sensor, that is 24x36mm for a full frame sensor and about 15x24mm for APS-C, meaning that you will cover the film area with four frames, which then is stitched in Hugin.
If you use a full-frame sensor on 35mm film there is no need to stitch (film size = sensor size), but one typically wants higher sample resolution on 35mm film and then stitching with an APS-C camera may be a better solution.
Why mess around with stitching at all? To get higher resolution so you can make large high quality prints! However, how much resolution you need will depend on the situation, so in some cases you can shoot the whole frame at once. Fine-grained film has a native resolution of about 4000 ppi, which corresponds to about 21 megapixels on 36x24mm, this is also a typical scanning resolution of high quality scans. Note that you start see grain long before you have outresolved the film's finest details.
You will need
- A fairly high resolution digital camera
- A good quality macro lens suited for repro photography
- low distortion, sharp corners, flat focal plane
- A light table
- Copy stand or corresponding arrangement
I have myself used a Canon 5D mark 2 (21 megapixel) as full-frame and a Canon 7D (18 megapixel) as APS-C. I have used the Sigma AF 150mm f/2.8 EX DG HSM APO Macro OS lens.
The 5Dmk2 with this lens produces about 3600 ppi of resolution (out of 3900 in pixel density) at f/8 over the full area, while the 7D produces about 5100 ppi out of 5900 at f/5.6. This have been tested with a resolution test slide of the same type used for testing film scanner resolution. In other words, the 5D resolution exceeds a typical medium format film scanner (3200 ppi) and 7D a 35mm film scanner (4000 ppi).
Concerning copy stand, I have actually used a regular tripod and a 90 degree bracket built from arca swiss-based pano head, and attached a focus rail to that so the camera is perpendicular towards the ground, and just place the light table under. I also got use from my leveling head from the pano head setup. Focus rail allows me to finetune center focus distance, and the leveling head to fine-tune perpendicularity to get sharpness in the corners.
Concerning light tables there are cheaper thin portable ones, and more expensive larger ones. The color rendition is probably good enough or maybe even the same on the cheaper ones, but the more expensive have probably better light uniformity. I use a thin portable type and think it produces good enough results, i e the small light variance it has is not detectable when passed through real images.
For full-frame f/8 is the aperture to use. f/5.6 may yield a slighter sharper image due to less diffraction, but the depth of field becomes impossible. For the smaller area the APS-C frame covers f/5.6 is feasible. You need a lens that perform well at these apertures, which macro lenses usually do.
At full-frame f/8 the depth of field is about 0.6mm. This is small, and one of the major challenges doing this is to keep the film within the DOF.
If you have mounted slides, film flatness is usually not a problem if they are well-mounted. You also get some air between light table glass and film which is necessary to avoid newton rings.
If you have unmounted slides, then precisely cut out a frame in cardboard, tape the slide to one side (not all sides, almost impossible to make perfect, the slide film will curl, at least if 6x6 medium format). This cardboard frame is to give some space to the light table, and avoid light leaks on the side of the film. All light must come from the back of the film or else you will get contrast problems.
Curl is a problem with larger slides (medium format), but one can fortunately make use of the fact that only a smaller part of the film is shot at a time. You can thus make an overlay from a smooth flat hard material with a 30x45 cutout or so which you lay on top that press down the film, and you move the light opening to fit where you currently shoot. Put a lens shade or similar on top of the cutout to weigh it down and to avoid stray light from the sides. Instead of a cutout you can have two plastic cards or similar put on top of the film leaving a gap for the camera.
If you are going to digitize many unmounted slides, make a quick and effective reusable frame mount, since one otherwise may end up spending most time mounting the film.
When film is mounted as flat as possible, focusing is the next challenge. You absolutely need live view with zoom for this. In my suggested setup one focuses on the center of the frame using the focus rail, lock it down and the check the corners with zoomed in live view and adjust with the levelling head if necessary.
You will notice that at f/2.8, which is what you'll probably focus in, the DOF is about 0.1mm and at then it is impossible to have all parts of the frame in sharpest focus. If your lens have lots of field curvature then it may be hopeless, but even with a good lens the marigins are too small at f/2.8. However by careful adjusting you can get all parts into close-to-sharpest-focus which is good enough when you take the shot at f/8 (when DOF increases to 0.6mm). Focusing correctly is a key part of getting good result. A bad focusing job and your digitalization will be worse than a cheap flatbed scanner would do.
For APS-C and shooting 35mm when the film area covered is smaller and film curl usually less of a problem you may attempt f/5.6. Actually you'd probably want to, since the small pixel cameras start to loose significant resolution due to diffraction if used at f/8.
Then there is the dust problem. A transparency shot this way will never be 100% dust free. You will have to accept some dust and include dust retouching into the equation. It is not all bad though, when you later stitch blue featureless skies you'll often find yourself using dust spots as anchors for control points :-).
Use a dust blower, a soft brush and possibly burn candles close to the light table to cause an upward air flow to keep away as much dust as possible.
Watch out for vibrations. Mirror up (typically shooting in live view mode) and cable release is mandatory. An interesting experiment is to zoom in live view maximally and tap the camera or stomp the floor, and you'll see how easy it is to introduce vibrations, which will take away that resolution edge.
Shoot RAW in manual mode and adjust exposure as close to clipping as possible, but do not clip! Rather use some safety margin than clip.
Convert the RAW files to a neutral 16 bit prophoto tiff in a high quality RAW converter. To get that final edge on resolution you need a first class demosaicing algorithm. RawTherapee does this well, but there are also other alternatives.
Correct the following properties:
- chromatic abberation
- (barrel/pincushion distortion)
- color reproduction (apply icc profile, see color management)
- hot/dead pixels
RawTherapee has an auto-mode for chromatic abberation correction, but since film slides themselves may contain abberations from the lenses used when it was shot, it is better to make to use statically tuned CA correction to avoid interference. Make test shots of a resolution slide for example, put in all four corners and find it tuning parameters. Good quality digitalization requires very good CA correction of the lens, so we have high image quality over the whole lens area. Even lenses with low CA usually improves with correction.
Should the lens have much quality issues in the corners one can use large overlaps and crop masks in Hugin to avoid including those in the stitch, but with large overlaps one needs more shots which takes more time.
Barrel/pincushion correction is normally better to let Hugin do. My experience is however that in this type of stitching Hugin can overdo its barrel correction, so one may need to compensate on the final output. Correcting barrel distortion in pre-processing often leads to worse stitching results though (when Hugin does not have the barrel parameter to play with), so I choose to leave barrel distortion uncorrected.
The lens I have used here has extremely low vignetting, so vignetting correction for that was unnecessary. Hugin can also correct for vignetting (not a part of layout optimization, so it won't disturb), so it is a matter of taste were you correct it. Corrected in pre- processing you save some time in stitching, then you can skip the exposure-tab alltogether.
Don't do any further tunings like sharpening and contrast etc, I think it is better to leave that until after stitching when you can open up the stitched tiff again in your favourite RAW converter or photo edit software.
Light tables usually have cold cathode lamps which has good but not perfect color rendering index (CRI), I consider it good enough for professional use though (drum scanners do have halogen lamps that have CRI 100 which is required for 100% perfect results). The light from the light table is similar to daylight spectrum (will look blueish in an indoor setting), but still without calibration the colors in your shots will not be correct. Either you play around with white balance etc until you get a pleasing look, but to get a good consistent result you really need to calibrate your system.
For this you need to get an IT-8 transparency and get the associated text file which contains information of the color properties of that transparency.
You can use Argyll to make an icc profile:
- Get it-8 target reference text file, often available on the manufacturer's web site.
- Shoot the it-8 target on the light table, good exposure without clipping
- Develop from raw, if rawtherapee use "save reference image for profiling" (16 bit tiff gamma 1.0 no input or output profile)
- Run argyll
- scanin -v2 -G1 -a -dipn file.tif it8.cht it8ref.txt
- colprof -v2 -D"Canon 5Dmk2 Gepe lightbox" -qu -am -u file
This generates a matrix type icc profile, LUT is more risky and rarely better for cameras. This profile is then used as input profile when converting RAWs of transparencies shot on the light table and the camera used when the it-8 target was shot. Should you change camera model or light table lamps (lamps can vary a bit) you need to make a new profile.
Hugin stitching tips
Theoretically, the stitching part should be straightforward. Unfortunately various micro errors can make it a bit difficult.
- different roll on the images after moving the film on the light table
- very slight yaw/pitch errors due to non-perfect perpendicularity
- film curl variations after moving
- lens distortions which does not 100% match lens distortion model in Hugin
Just like your shots never will be 100% dust free, there will not be a 100% perfect stitch. It will be good, but not 100% perfect. Seams should be invisible inside the picture, but at the film frame border you will probably see say 1-4 pixel mismatch. The grain structure in a blue sky might be disturbed where the seam passes so in some cases you might see traces of the seam, but no worse than traces from healing brush after dust removal. You will also likely get some slight distortion of the rectangular frame, it will probably get a little slightly bent.
However, after cropping away the film border the result should be very good. The amount of picture area you lose due to (very slightly) bent film borders is probably smaller than you typically lose in a film scanner due to limited scan width. A scanner will always be better at linearity though, so if it is a higher priority than resolution and dynamic range for you, then a scanner is the way to go.
Another issue is that there is no Hugin workflow that guarantees the best possible result, variations in control points, optimization order etc can give slightly different results. If you get a difficult case it may be worthwhile to play around with the parameters.
Here's a good starting point though that should give you good results in most cases:
- Create new project
- Load images
- If EXIF data lacks, enter a small FOV, say 2 degrees. FOV is only used if yaw/pitch optimization which is normally not used.
- Goto Images tab and auto create control points with Hugin CPFind
- Goto control points tab and add only one horizontal or vertical guide in one picture
- Typically along the film frame border on the middle row (if only four pictures on the top or bottom row)
- The horizontal/vertical guide is to instruct Hugin how the image should be rotated
- It will be tempting to add guides all away around the frame to get a perfectly retangular frame, but it is generally not worth it - stitching result will be worse, it is better to accept minor distortion in the frame and get invisible seams
- Add one vertical or horizontal guide on only one image to indicate orientation
- Goto the optimizer tab, here we work custom so select "the Custom parameters below"
- The general idea is to optimize the large movements first to give Hugin a good starting point and then add on more minor parameters and re-optimize
- First opitmize X and Y on all but one
- Open GL preview and check the layout - perhaps we need to add some more control points? Blue skies may need help.
- It's easier to see the layout when a rough optimization has been made first, that's why we saved this until now.
- Pictures with very small overlap (i e corner overlap between top-left and bottom-right picture) may be better to not have and CPs between them, so it gives Hugin more freedom to adjust where fit matters
- Generally Hugin CP find has done a good job so no more points are necessary
- Then add roll to all, and re-optimize
- Then add Z to all but one and barrel, and re-optimize
- Z should theoretically not be needed, but may help to get a better stitch and will not generally mess upp things
- If there are any outliers (large max error), it is common than CPfind has added a one or a few bad control points, goto Images tab and press "Clean control points" (will remove outliers) and then back to optimizer tab and re-optimize
- Now you will often have "very good fit" with subpixel accuracy
- If you don't seem to manage to get a good enough fit, playing with yaw/pitch optimization may in some cases help
- Providing a very small FOV such as 2 degrees as a starting point (change in camera and lens tab) may help to avoid getting huge distorting corrections
- If the film frame get too much bent, you can try placing the horizontal/vertical guide on another picture
- Open up GL preview
- Choose rectilinear projection
- Mosaic-drag so the center is in the center of the image
- Fit/autocrop the view
- If lens does not vignette much, exposure tab can be skipped
- Goto the stiching tab
- Press "calculate optimal size"
- Exposure corrected low dynamic range output should be selected
To go from "very good fit" to 100% perfect, Hugin would need rubber sheeting to correct the small residual errors. Perhaps we'll see that in the future. Rubber sheeting adjustments could also make the frame perfectly rectangular. For now I would say that it is "good enough".
If you seem to have an impossible case, try to reshoot and be very careful with film flatness and perpendicularity. You can also try to have a bit more overlap and shoot more pictures, say 8 fullframe pictures of a 6x6 medium format slide instead of 6 (which is the minimal possible). Large overlaps usually give better stitches, but on the other hand consumes more shooting time.
The look of film transparencies is usually just the way you want them freshly digitized, just adjust exposure to fit the highlights just below clipping. That's normally all it takes when color calibration has been used. Negatives need to be reversed to positives of course.
The big thing is however dust and scratch retouching, which is kind of mandatory, they digitized images are never 100% dust free. As a Linux user it is unfortunately hard to find a photo editor that has a good healing brush and supports 16 bit tiff. If you are going to use Gimp it is only 8 bit so you have to live with that. In the Mac/Windows world there are many alternatives, but most of them are rather expensive if you just need the healing brush. PhotoLine is one of the more affordable ones. If one wants to, one can make the dust healing on a separate layer to avoid modifying the original.
Some film transparencies are very contrasty and have very dense shadows. If you want sufficent dynamic range on these to get noise-free shadows in your prints you will need to do HDR. Use the camera's built in bracketing function, shoot in live view and use a mount to be sure that the camera is not disturbed during and between the bracketed shots. Two shots 4-6 stops spaced is usually good.
At the time of writing (Hugin version 2011.4) I have not got Hugin's builtin HDR function to work well (hugin_hdrmerge has some issues) so I have used external HDR software in these cases.