Fbfscan is a python script for Raspberry Pi allowing interactive and automatic controls of a digital camera and a stepper motor to allow for frame-by-frame film scan. Support for "flat" exposures, High Dynamical Range (HDR), calibration... are provided. Fbfscan is built on top of gphoto2 for controlling digital cameras and wipistepper for controlling stepper motors.
Please ensure that you have a working installation of wiringpi, its python wrappers WiringPi-Python, wipistepper, gphoto2 as well as python-gphoto2. Fbfscan also relies on curses-menu and curtsies.
The directory "process/" contains a few scripts for processing the raw images into EXR images, as well as tone-mapping them afterwards. For these scripts to work, you should have a working installation of pfstools, astropy, netpbm and dcraw.
Simply plug a digical camera to the Raspberry Pi (RPI) using an USB cable and switch it on. A scanner object is initialized with only a name (see scanner.py):
def __init__(self,name='',pylog=True, summary=False):
Only a few method from gphoto2 are wrapped for a scanner object:
def get_exposure_time(self):
def set_exposure_time(self,choice):
def get_iso(self):
def set_iso(self,choice):
def get_exposure_bias(self):
def set_exposure_bias(self,choice):
def single_capture(self,path,filename,success=True):
Notice that choice should be an integer (see gphoto2 help) and single_capture() triggers one shot with the set exposure and set iso and save it under path/filename.
Fbfscan should be started within a xterm and possibly in "sudo" mode for allowing hardware access to the RPI. It is assumed that a digital camera is plugged in (via USB), on, and fbfscan will first attempt to initialize a scanner object from it. If no camera is connected, fbfscan will proceed with a warning message. A stepper motor controlled by a driver is expected to be connected to the RPI and will be initialized, if found, as (see fbfscan.py):
def initialize_motor(stepmode):
connections={'en':0,'clk':1,'cw':2}
defaultvalues={'en':0,'clk':0,'cw':1}
motor = wm.motor(drivername='Kinco-2CM880',motorname='QSH6018-65-28-210',
wiring=connections, states=defaultvalues,
stepmode=stepmode,
pulsewidth=10,
clockwidth=6.5104, range=4096,
stepangle=1.8)
These default settings should certainly be edited, such as the default stepmode, storage path for scans, flats and bias images. For this purpose, an editable config.ini is provided, which is initialy read and will override most of these options. Check out your driver and stepper motor settings, see wipistepper for more details. Other editable settings are:
#stepmode
inistepmode = 16
#storage path for output scans
toppath ='/home/alarm/tests/'
imgpath = toppath + 'scans/'
flatpath = toppath + 'flats/'
zeropath = toppath + 'zeros/'
#img settings
imgroot = 'test'
imgtype = 'nef'
#hdr default settings
hdrframe = 3
exprange = 2
They specify how many hdrframe you want for each scan image, what exposure range (exprange) they spawn (here 2 stops). These can also be edited interactively using the fbfscan settings menu. A summary of the default settings is displayed during the initialization, after which, the main menu shows up:
The first entry allows to control the stepper interactively, using arrows, entry key and space bar:
The second entry leads to the scanning control, pictures and frame forward are taken automatically:
The setting menu allows to modify on the fly various default parameters:
Finally, "calibration" allows taking flat field exposures, bias exposures or adjust the film position by moving it by a given number of frames:
The beast running and controlled from the "motion" menu:
The disco lights flashing on the back:
Good Luck!