I finally managed to simplify my film scanning software setup to usable level.
If you have read my previous entries, you may recall that I have used commercial scanning software (VueScan) for scanning, Lego “G language” for the film mover control inside NXT, custom Java SW for splitting frames from scans and a bunch of Python scripts to tie all this together (using Dogtail to control Vuescan…) Although this kind-of-worked, the setup was very error-prone and difficult to set-up. So I decided to get rid of all other components and integrate all functionality into a single application.
My first step was to change NXT firmware into leJOS, an open source Java virtual machine that runs in NXT. This was my first experience with leJOS and it was very positive one. Of course, Lego’s graphical programming environment is very good for its purpose of teaching robotics to children, but real programming language has still clear benefits - especially when implementing communication between PC and NXT. leJOS was really simple to use - I haven’t have so much fun writing software for long time. Highly recommended.
While redesigning the NXT software I also changed communication channel from Bluetooth to USB to ease system setup.
Scanning from Java
Next I started to look for alternatives for VueScan. There are several solutions available for controlling scanner from Java application. Most of them use the SANE network protocol to access scanner in Linux, and I did not want that as my scans are big (one strip is roughly 240 MB). In the end I decided to access SANE native libraries directly via JNA.
I receive the raw linear 16 bit scanner data and store it to a tiled TIFF file (another benefit from implementing scanning myself was that I could reduce memory usage by selecting optimized tiling scheme). I then detect the perforations and either save individual frames immediately or store the perforation information to XML file and do splitting later (I prefer the latter method as I can then adjust colors and correct any errors manually)
The only thing I miss from Vuescan is infrared cleaning that is not supported by Sane’s Epson back end. Thanks to some help from Internet community I now know how to enable infrared in the scanner, but this must still be implemented in SANE back end. Also, actually using the infrared channel would require proper and fast dust removal algorithm. For now I am relying in a more traditional dust removal method: antistatic cloth and pressurized air…