I have completed three ScanCams, and am now designing a fourth. All are made from scanners based on the
National Semiconductor LM9832 “scanner on a chip”.
Photography is not document scanning. The calibration and processing of image data
must be handled differently, and the scanner hardware is asked to do some
things it wouldn’t ordinarily do. Only
the LM9832 (so far as I know) is both versatile enough and well enough
documented to support the development of good software for photography. It was widely used in first generation USB
scanners in the period 1999 - 2002.
Suitable scanners of several different brands are now available used at
prices around $35 - $50. You can find
a pretty complete list here (note:
the Canon N-series and LiDe scanners, which use contact image sensors, are not
suitable).
The only thing I don’t like about the LM9832
is that it is not as fast as it could be.
The chip can only process 1 million raw CCD pixels/sec, and the USB 1.1
interface transfers at most about 300K processed pixels/sec. Newer USB 2 and firewire scanners can scan
at 1.5 megapixels/sec; alas, I have not yet found a way to program one as a
camera.
ScanCams Mark 1 and Mark 3
were made from 600 DPI Umax Astra 3400 series scanners, whose CCD image sensor
has 5400 pixels spaced at 5.25 microns for a total sensitive length of 28.35
mm. This is reasonable coverage for
very wide angle lenses but does not deliver the full resolution of “normal” SLR
lenses.
Mark 2 was made from a 1200 DPI Umax Astra
5470. CCD length is 42.4 mm, almost the
diagonal of a 35mm film frame, with 10,600 4 micron pixels. The optical head has a 42 x 1mm thread that
accepts Pentax screw mount (M42) lenses.
I have used it with 55mm and 28mm Asahi Takumar lenses and a Russian
Zenitar 16mm fisheye. The Asahi lenses
show crisp detail right down to the single pixel level; the Zenitar is a bit
softer.
Mark 4 will be made from an HP Scanjet 2200c, a widely available 1200
DPI scanner of slightly higher mechanical quality than the Umax units. Like Mark 3, it will have a Minolta bayonet
lens mount, which with low-cost adapters will also take M42 lenses.
ScanCam drives use the scanner’s stepping motor and at least part of its
gear train. The final drive stage has
evolved from a toothed belt in Mk 1 through a homemade plastic worm gear in Mk
2 to store-bought precision worm
gears in Mk 3 and Mk 4. To avoid damage
if the worm gears jam, they are coupled to the scanner’s drive through a slip
clutch; in Mk3 and Mk4 this is a simply a short piece of neoprene tubing
connecting two polished shafts.
Worm gears give a compact and simple drive train with enough reduction
for high resolution scanning and little or no mechanical play. Mk 2’s homemade
gear is made of Delrin, a tough but slippery plastic. I machined it in place on the camera hub
using a 3/8-16 spiral tap as a hob.
This method is almost foolproof as the hob turns the gear just the right
amount while cutting it. The worm is a piece of precision threaded rod running
on ball bearings inside a piece of steel tubing. This gear set is very smooth and needs no lubrication, but has
limited tooth contact area compared to the commercial bronze/stainless worm
gear sets used in Mark 3 and Mark 4.
The LM9832 drives the stepper motor with sinusoidal current waveforms, so that it moves quite smoothly even at slow “stepping” rates. So a continuous range of scanning speeds is available, which is critical for photography as both angular resolution and exposure time affect the required speed. The relevant formulas are…
CCD pixels per degree = 1 / arctan ( pixel spacing / lens FL )
scanlines per degree = CCD pixels per degree / resolution reduction ratio
steps per scanline = steps full circle / 360 * scanlines per degree
steps per second = steps per scanline / exposure time
The exact drive ratio (steps full circle) is not important, but it must keep the motor speed within certain limits. The slowest speed, for scanning at high angular resolution (long lens) and long exposure time, should not be less than about 1 step per second else the motor may stall or jitter. The fastest speed must be safely below the mechanical resonance of the motor, else it may “sing” instead of rotating (and might burn out). The motor in the Umax scanners resonates at about 500 steps per second, so I use a limit of 450.
ScanCam Mark 2 has a drive ratio of 29,430 steps full circle. It can scan at full CCD resolution with a 55mm lens up to an exposure time of 85 milliseconds. Mark 3, with 30% wider pixels and a fixed 8mm lens, could in principle be geared for as little as 4,000 steps full circle, but that would risk overloading the motor, so it actually has 9600 steps full circle.
All the ScanCams rotate on ball bearing hubs and use the scanner’s
optical detector to sense “home” position.
Each has a different mechanical arrangement to let it scan more than 360
degrees from home without getting a spurious home signal at the 360 degree
position. In Mk 1 this was a toggling vane on the hub, activated by wire cams
mounted on the drive base. Mk 2 uses a rotating vane mounted on the base and activated
by a pin in the hub. In Mk 3, the vane
is on a belt driven pulley that rotates a little slower than the hub. Mk 4 will most likely have a pivoting vane
on its hub, activated by a pin on the base.
It is not feasible to eliminate all play from a worm gear drive, as even
a tiny speck of dust can then jam it.
When Mark 2’s drive is loose enough to avoid jamming, it has enough play
to wobble slightly in a breeze, which tends to spoil high resolution
pictures. Mark 3 has an anti backlash
device – a long flat coil spring, salvaged from a retracting USB cable, that
gives a light constant pressure in the direction against the scan. I will soon be fitting Mark 2 with a
similar but heavier spring.
The ScanCam optical heads combine a lens mount with a
filter/shutter/sensor assembly made from the scanner’s lens cone, sawn from its
plastic carriage assembly. The cone and
lens mount are machined to fit together snugly and either clamped or
glued. The scanner’s CCD board is
attached to the lens cone with screws that have loose holed to permit aligning
the sensor after the camera is assembled.
The distance from the lens mounting flange to the CCD mounting surface
is set according to the flange-to-film distance for the chosen lens mount, plus
the internal height of the CCD chip and minus 1/3 the thickness of the IR
blocking filter. In Mk3 and Mk4 I
deducted another .040” to allow for rubber strips between the board and the
mounting surface which allow fine adjustment of the infinity focus position and
CCD tilt when compressed by the mounting screws.
A light-tight casing around the back is essential to prevent ambient
light leaking through the circuit board.
Most of my lenses are M42 (“Pentax screw mount”, used too by many other
manufacturers) mainly because that was a mount I could make on my lathe. Also
there is a huge supply of fine (not to mention “interesting”) old M42 lenses
available at cheap prices. But the
Sigma fisheye for Mark 3 has a Minolta bayonet mount, and Mark 3’s body is made
from a Minolta-to-C-mount adapter with the scanner lens cone glued to the
back. This was such an easy and clean
job, and the bayonet mount is such a pleasure to use, that I intend to make all
future ScanCams that way, and use M42-to-Minolta adapters on my Asahi lenses.
An infrared blocking filter is necessary because the “red”, “green” and
“blue” elements of a silicon detector all are sensitive to the infrared
wavelengths abundant in sunlight and incandescent room light. Without an IR filter, colors are extremely
washed out, and image sharpness suffers as well. I have used both colored
glass and colorless interference
(“hot mirror”) filters with good results.
I prefer the colored glass filters because they reduce the red response
of the CCD to better match the green and blue responses.
Ideally an IR filter should go in front of the lens, but putting it
behind the lens has the great advantage that you need just one small filter
instead of several large ones, and it also works for bulgy wide angle
lenses. I put Mk 3’s IR filter in the
Sigma fisheye lens’s internal filter holder since putting it back of the lens
seems to spoil image sharpness. This is
OK as Mark 3 is basically dedicated to this lens, though I can also use the
Zenitar 16mm with an M42-to-Minolta adapter and an IR filter in that lens’s
rear filter holder.
The shutter is closed briefly before each scan to record the sensor’s
dark background signal, which varies with temperature and exposure. It is a simple flap on a hatpin axis turned
by a tiny permanent magnets near coils of wire. The scanner’s lamp control circuit, which is under computer
control, supplies the coil current, and a fixed permanent magnet acts as the
return spring. Here is Mk 1’s shutter in closed position (it just covers the CCD.
The glass in front of it is a Tiffen hot mirror IR blocking filter).
Since these cameras record only a narrow vertical image, it is appropriate
to put a “sunshade” in the form of a narrow vertical slit in front of the
lens. This greatly reduces the amount
of unwanted light entering the camera, which may help image contrast and
definitely reduces flare in the wider lenses.
The width of the slit should be a little more than (focal length) / (
fnumber), for example I use a 3mm slit on the Sigma 8mm f/4 and a 7mm slit on
the Zenitar 16mm f/2.8. These slits
really are aperture stops, so it is possible, for example, to reduce sky
exposure by adding black tape to make the slit narrower at the top – the same
effect as a gradient filter, at much lower cost and complexity.
Slit-scan cameras don’t require precise alignment of the rotation axis on the lens rear nodal point, because each line of the image is a separate photograph taken at the lens center. Parallax may subtly change the shapes of objects at different distances, but does not create any visible image defects. In the ScanCams, only the green image is actually centered, the red and blue are taken slightly off-axis, so parallax does affect color alignment. This is visible in extremely close objects and at very high angles with fisheye lenses, but has not been a practical problem for me.
Rotation axes are within a few tenths of a mm of the optical axis in both ScanCams, achieved just by decent machining tolerances. The position of the rotation axis along the optical axis is not at all critical. I built an adjustment for this into Mark 2, but have never adjusted it. The axis is within a few mm of the iris diaphragms of all 3 lenses, and that is good enough. Mark 3’s axis is simply fixed.
It is critical that the CCD lies on the lens axis and is parallel to the rotation axis. I adjust this by scanning a pattern of three horizontal and one vertical black threads on a white wall with a fisheye lens, with the rotation axis set accurately vertical. The middle horizontal thread is at the height of the lens, and the upper and lower ones are 90 to 120 degrees apart as seen from the lens When the CCD is centered on the lens, the image of the vertical thread is perfectly straight; when it is parallel to the rotation axis, the apparent angle between the two threads is exactly 90 degrees. I make coarse adjustments by eyeballing preview scans, and fine ones by calculating errors from coordinates measured on high resolution images. I find I can get satisfactory results with careful finger adjustment of the CCD board position; screw adjustments would be nice but aren’t necessary.
These items give the most trouble in practice. It is important that the cables not come loose while taking pictures, that the camera power supply is free of hum and noise, and that the USB cable matches the USB electrical specifications.
The cables connect at the bottom of Mark 2 and used to fall out regularly until I taped them together and attached a thick rubber band that slips over a pin in the side of the camera case. Now they only fall out when I tug on them too hard.
Mark 3 has angled connectors recessed into its base plate and has not so far lost its cables in use. However it did have a problem with unreliable USB operation due to a poor impedance match of the flat flex cable I originally used to connect the main board to the base plate. I have now replaced this with a piece of a retractable USB cable, plus a 4-conductor flat ribbon cable for the 12V power that has less resistance than the flex cable did.
I generally power the cameras and the laptop from a scooter battery, which is heavy (30 lbs) but lets me take pictures all day without recharging. The battery box sits under the tripod and serves as a computer table. It also houses a small charger and a car power adapter that provides 16 volts for the laptop, and has shoulder straps for carrying it around. As the laptop power converter creates quite a lot of AC noise, I have isolated the camera power outlet with a noise filter from an old computer power supply. For “quick snaps” or sites that require serious climbing, I power the camera from a 12V NiMH battery pack that hangs on the tripod, and run the laptop on its internal battery.
The HP 2200c I plan to use for Mk 4 takes in16 volt power and makes regulated 12V internally, so I will probably power it from the laptop’s power converter – or maybe a second one.
I developed my ScanCam software application (called CamScan) largely from scratch, using the LM9832 specifications and a sample driver published by National Semiconductor for guidance. It uses two important pieces of open source software, libusb-win32, which is a Windows port of a Linux user-mode driver for USB devices; and libtiff, a portable library for working with TIFF image files. I chose to save images in TIFF format because it is very widely accepted and supports 16 bits per color.
The core of the software is a C++ class. ScanCam, that represents a working camera. It accepts commands like “adjust DC offsets”, “move to 157 degrees” or “scan image” from an application software layer that interacts with the user. ScanCam is derived from a more general class, ScanCamDescr, that represents all existing ScanCams, recognizes the one attached to the computer, and sets up a table of camera specific parameters. Both are written in portable code (nearly) independent of the operating system.
The application layer is very Windows specific, built with Visual C++ using MFC. Its main job is to set up image parameters and to display and file the images. It also let one run various camera calibration functions such as “set white balance” or “flatten lens field”. The ScanCam layer files or loads calibration results for the current camera and lens automatically, which can also be done manually.
Even cheap document scanners deliver amazing image quality. The main reason for this is that the scanner electronics correct the response of each pixel in the image sensor, by subtracting its measured dark signal then multiplying by a gain inversely proportional to its measured light sensitivity. This correction gives a nice flat background and uniform response, comparable to that of photo film. The gain correction table also flattens the radial response function of the lens, so a properly calibrated ScanCam actually has a more uniform response than a film camera. I take gain calibration data with a uniformly illuminated white diffusing sheet and/or out-of-focus white screen in front of the lens. I generally store 2 or 3 flattening curves for each lens, as the radial response changes with the aperture setting.
Like other electronic cameras, a ScanCam can work in all sorts of
lighting without correction filters, thanks to a white balance calibration that
sets the relative red, green, and blue gains to make the incident light appear
“white”. My software adjusts white
balance with the LM9832’s analog gain controls, so it is independent of the
pixel gain and lens shading corrections done after digitization. The field flattening routine files an
incident light white balance, but it requires “laboratory conditions”. While shooting, I just put a white card in
front of the lens and do a “spot white balance”, which uses the average R, G,
and B over a central “spot meter” area to set a white balance without changing
the pixel correction tables.
There is enough gain range left over to allow boosting relative “film
speed” by more than 2 stops when balanced for daylight, and over 1 stop with
incandescent balance. I call a gain of
1 “ASA 100” since that is pretty close to the cameras’ actual photographic
speed -- in bright daylight, typical exposure time per scan line is 1/60 sec at
f/11.
The LM9832 also has analog controls for adding a DC offset to the CCD
signal. The software adjusts these
according to exposure to nearly cancel the average dark signal, leaving just a
small positive average so that the digital offset correction can remove the
differences between pixels. Analog
offset correction is important because it lets the ADC digitize mostly the
light signal, using less than 2% of its range to measure dark signal. Without it, the image dynamic range would be
seriously reduced at long exposure times.
The LM9832 takes 14 bit digital samples, and can transfer these to the
computer if desired. Normally however
the chip makes 8 bit samples via lookup tables that use the 12 most significant
bits of the raw data. This is important
because it doubles pixel rate on the USB link.
The lookup tables can be loaded with a nonlinear function to achieve a
certain amount of dynamic range compression or expansion. A popular function is the “gamma
correction”, y = x-to-the-power-gamma.
CamScan allows gammas from 0.3 (extreme compression) to 2 (serious
expansion). I tend to use gamma = 0.7
for most pictures, 1.0 for uniformly bright scenes and 0.5 for predominantly
dark ones – but this gives a lot of “grain”.
Making a ScanCam picture to hang on the wall goes something like this.
1) Identify a subject. Think about composition and lighting while waiting for the right weather conditions.
2) Remember to charge the batteries and pack all cables, sunshades, etc. etc.
3) Lug 60 pounds of gear (backpack plus battery box) to shooting site.
4) Set up camera on tripod with power box and computer underneath. Power up and boot up.
5) Make sure S/W has right lens and white balance; spot balance if necessary.
6) Aim the lens at a good starting point and level the camera.
7) Enter scan height and width (degrees), exposure time per scanline, resolution, image file name, gamma….
8)
Point lens where exposure and focus are critical. Using “focus” mode to view live scanlines,
adjust
focus and aperture, and Polaroid sky darkening filter if used.
9) Take a low resolution “preview” scan; check and adjust composition.
10) Try to relax while camera scans the high resolution image.
11) Shut down; pack up; lug out.
12)
Copy image to home PC
and load it into Paint Shop or Photoshop.
Crop, adjust color, brightness, resolution
etc. Use PanoTools plug-ins to get the
desired projection (e.g. change vertical axis from rectilinear to spherical,
then perhaps extract a rectilinear view; or just stretch and warp till it looks
right).
13)
Print on best quality
matte paper on a big format inkjet. I
use my cousin’s 13 inch Epson 2000 Pro mostly,
commercial 40 inchers for seriously big prints (about $8 / sq. foot at Kinko’s,
even less at mom & pop’s).
14) Have it framed, preferably at the new owner’s expense.
For indoor pictures the most difficult thing is to get suitable lighting. Windows and lamps can kill whole strips of the image by saturating a few pixels, and there are amazing amounts of gloomy corners and corridors in many interiors. Here are some things I’ve tried, with occasional success. 1) mount a pair of 500W halogen lamps on the camera head. This gives typical “strobe light” effects including harsh reflections and weird shadows, but it does make things visible. 2) light parts of the room well, make a scan, move the lights, make another scan, and so on till you’ve got enough good pieces to cover the whole scene. The image combination function, “select brightest” is very useful for putting the pieces together. If your lights, as seen from the camera, are darker than what is behind them, they pretty much disappear automatically. (BTW I use halogen work lights, which are way cheaper – and way more awkward -- than photo studio lights).
ScanCam images with lots of pixels can stand up to a lot of reformatting. I often make 360 degree scans into circular views, or QTVR movies for viewing on the computer, and stretch and warp images to suit my fancy.
One very useful application is copying large documents like maps and paintings. You can shoot from close to the subject with a fisheye lens, then rectilinearize the image using PanoTools software. I made a 4-foot square 1:1 copy of an old map this way that looks better than the original.