Difference between revisions of "High resolution film transparency digitalization using macro lens and stitching"

From PanoTools.org Wiki
Jump to: navigation, search
(Hugin stitching tips)
Line 169: Line 169:
* chromatic abberation
* chromatic abberation
* barrel/pincushion distortion
* (barrel/pincushion distortion)
* (vignetting)
* (vignetting)
* color reproduction (apply icc profile, see color management)
* color reproduction (apply icc profile, see color management)
Line 188: Line 188:
Barrel/pincushion correction is for normal panorama projects better to  
Barrel/pincushion correction is normally better to let Hugin do. My
let Hugin do. However, my experience for this special macro application
experience is however that in this type of stitching Hugin can overdo its
is that the Hugin optimizer does not behave that well as it does for
barrel correction, so one may need to compensate on the final output.
normal panoramas, here often overdoing lens corrections. Therefore I
Correcting barrel distortion in pre-processing often leads to worse
recommend correcting this in pre-processing as precise as possible.
stitching results though (when Hugin does not have the barrel parameter
Shoot something straight near the edges of the lens and adjust
to play with), so I choose to leave barrel distortion uncorrected.
correction parameters the line becomes straight.
The lens I have used here has extremely low vignetting, so vignetting  
The lens I have used here has extremely low vignetting, so vignetting  
Line 207: Line 206:
the stitched tiff again in your favourite RAW converter or photo edit  
the stitched tiff again in your favourite RAW converter or photo edit  
==Color management==
==Color management==

Revision as of 21:06, 1 February 2012


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.

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 16+ 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 professional level resolution so you can make large high quality prints! This tutorial is not about getting "ok" results (then just use a flatbed, or shoot the whole frame at once without stitching), this is about getting very high quality, and really extract the detail that is on fine-grained film.


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.

Shooting tips

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)
  • (vignetting)
  • 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.

Color management

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

TBD. 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

General guide so far is however

  • Add auto control points with Hugin CPFind
  • Add one vertical or horizontal guide on only one image to indicate orientation
    • Adding on several images seems to disturb optimization quite often
  • Optimize custom parameters
    • First X and Y on all but one
    • Then add roll
    • Then add barrel
    • Clean any poor control points, re-optimize
    • Accept non-perfect rotation and overdone barrel correction as long as it reduces stitching error
    • If desperate, you may try include yaw/pitch correction, with a hack - specify a very small FOV, 1 degree, then yaw/pitch corrections will probably be milder.
  • 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
  • Stitch to 16 bit tiff and rotate barrel correct the output if necessary

To handle the micro errors in the best possible way in this type of photo setup, Hugin should probably support rubber sheeting to correct the small residual errors. PTStitcher has a "morph-to-fit" feature which may be useful (not tested by me at the time of writing).


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.