Daniel Reetz, the founder of the DIY Book Scanner community, has recently started making videos of prototyping and shop tips. If you are tinkering with a book scanner (or any other project) in your home shop, these tips will come in handy. https://www.youtube.com/channel/UCn0gq8 ... g_8K1nfInQ

Laser Scanning Results

DIY Book Scanner Skunk Works. Share your crazy ideas and novel approaches. Home of the "3D structure of a book" thread.
duerig
Posts: 380
Joined: 01 Jun 2014, 17:04
Number of books owned: 1000
Country: United States of America

Laser Scanning Results

Post by duerig » 26 Sep 2014, 00:03

Thanks to Chrisoph's (guitarguy) help, I have managed to refine the laser scan postprocessing technique quite a bit. The current method will automatically detect left and right page boundaries, deskew, and dewarp all pages. The only hints you have to give it are to tell it whether it is an odd or even page and whether it is a scan of a single page or a double-page spread. There are still a number of enhancements to look into, but things are good enough now that it is reasonable to start scanning real books with this technique.

To give you an idea of both the power and limitations, here are a few cropped scans comparing the original photo with the dewarped image:

FIrst pair:

Image
Image

Second pair:

Image
Image

Third pair:

Image
Image

As you can see, it handles curved text extremely well. There are still times when there remains a very slight tilt, but it is almost perfect. The weakness is foreshortened text. It stretches out the foreshortening a small amount, but nowhere near enough to pull it back to its original proportions.

Because of this limitation, the technique will be most useful when the operator is holding the book at the edges to minimize foreshortening. It will also work better on smaller books because it is easier to hold their pages straight from the edges.

Using cheap lasers, it is now possible to build a scanner that is extremely simple mechanically but yields good quality scans.

Other links:

The laser-dewarp github if you want to try the current version of the script yourself: https://github.com/duerig/laser-dewarp

Full-resolution scans and dewarped pages used in the above crops:

Image: https://files.app.net/wh25n7-cn
Laser: https://files.app.net/wh25lOiXX
Even Dewarping: https://files.app.net/wh225MxY-
Odd Dewarping: https://files.app.net/wh22wWt6O

Image: https://files.app.net/wh22hkzpz
Laser: https://files.app.net/wh25t9N4D
Even Dewarping: https://files.app.net/wh22zcTp0
Odd Dewarping: https://files.app.net/wh220P92a

If you want to build your own laser rig, have ideas of how to improve things, or have any other questions feel free to ask here.

duerig
Posts: 380
Joined: 01 Jun 2014, 17:04
Number of books owned: 1000
Country: United States of America

Re: Laser Scanning Results

Post by duerig » 27 Sep 2014, 13:19

I've figured out a way to almost entirely get rid of the foreshortening problem. Compare these images:

Original: https://files.app.net/wh25n7-cn
Uncorrected: https://files.app.net/wh225MxY-
Height-factor=2.0: https://files.app.net/whs2tEK5g

The new height-factor is a command line option that you can tweak when transforming. For a given camera position/laser-position/zoom-level it will yield consistent results. If you change configurations, you will have to find out a new height-factor. At some point, we should be able to come up with an automated callibration process for it using a chessboard image or something similar. In the meantime, just eyeballing it gives amazing results.

duerig
Posts: 380
Joined: 01 Jun 2014, 17:04
Number of books owned: 1000
Country: United States of America

Re: Laser Scanning Results

Post by duerig » 15 Oct 2014, 23:42

I've been working on ways to make the whole system more robust. I have managed to remove the need to detect the spine altogether. Instead, I can just dewarp the entire spread of two pages as a unit. I now detect hands at the edges of the page and eliminate them from the picture in addition to consistently eliminating the background and cropping to just the book. I have added a guide laser that is vertical, perpendicular to the other two lasers, and is turned off to actually snap a photo. The guide laser makes it easy to avoid skew while scanning. Finally, I've created a callibration program for the lasers so that they can be callibrated to within 1/10 of a degree relative to the camera.

Here are some examples:

Before: https://files.app.net/wdzpgY-wV
After: https://files.app.net/wdzzztxLO

Before: https://files.app.net/wdzpd7SI8
After: https://files.app.net/wdzzni2fF

Before: https://files.app.net/wdzp65_6u
After: https://files.app.net/wdz027kTd

Before: https://files.app.net/wdzp4NTPT
After: https://files.app.net/wdzzhKpjH

User avatar
daniel_reetz
Posts: 2780
Joined: 03 Jun 2009, 13:56
E-book readers owned: Used to have a PRS-500
Number of books owned: 600
Country: United States
Contact:

Re: Laser Scanning Results

Post by daniel_reetz » 16 Oct 2014, 00:14

I looked at some of these and all I can say is
003_resizedbefore.jpg
003_resizedbefore.jpg (98.51 KiB) Viewed 7080 times
WOW.
003_resizedafter.jpg
003_resizedafter.jpg (130.45 KiB) Viewed 7080 times

duerig
Posts: 380
Joined: 01 Jun 2014, 17:04
Number of books owned: 1000
Country: United States of America

Re: Laser Scanning Results

Post by duerig » 17 Oct 2014, 10:25

There was still a bit of foreshortening, so I tweaked the stretch factor (aka height factor), increasing it to 6 and the foreshortening is gone:

https://files.app.net/wdq1dye9S

But, to show the dangers of setting the stretch factor too high, here is an image with the stretch factor set to 20:

https://files.app.net/wdv1kWLC0

User avatar
dingodog
Posts: 106
Joined: 22 Jul 2010, 18:19
Number of books owned: 1000
Country: on the net
Location: on the net
Contact:

Re: Laser Scanning Results

Post by dingodog » 17 Oct 2014, 10:49

it would be useful a complete tutorial for people not as skilled as you into laser equipment scanning to try to experiment by themselves, describing all hardware needed

duerig
Posts: 380
Joined: 01 Jun 2014, 17:04
Number of books owned: 1000
Country: United States of America

Re: Laser Scanning Results

Post by duerig » 17 Oct 2014, 11:16

dingodog, I've been talking with Daniel Reetz about how to design a laser scanning rig that could be built easily from a kit or somesuch. I've also been working with Cristoph (guitarguy) who is building his own prototype as well. I'll be posting here as things progress. Here are some notes about how to build a laser rig I sent to Christoph recently:

Ok. Let me try to make a more or less complete equipment manifest for
the electronics.

Camera (must be compatible with gphoto2 or chdk)
Camera USB Cable
AC Adapter kit for camera (I don't have this yet for mine. And it is annoying when I have to recharge).
Lighting (two lamps, preferably clip-on for easy attachment, using flood bulbs. I am using halogen floods that are 620 lumens each.
Switch for lighting (PowerTail II or something equivalent with EU power in mind)
3 Laser Lines. I got these from dx.com (http://www.dx.com/p/2-5mw-line-laser-module-3v-46388). Maybe get 4 or 5 to experiment with or in case one doesn't work right.
Some (>3) jumper wires (male/female) http://www.adafruit.com/products/1954
Lots of jumper wires (male/male) http://www.adafruit.com/products/1957
Gator clips or Wago clips or something else that lets you clip wires together and run them from the lasers to the breadboard: http://www.adafruit.com/products/321
Small Breadboard (http://www.adafruit.com/products/64)
Micro-USB cable for Pi power
A 2-Watt wall wart to plug Pi power table into
Micro SD card (for B+ Pi) or SD Card (for older Pi), preferably 16gb or higher. Fastest speed class you can get.
3 or more NPN 2N222A transistors
You might need a USB extension cable depending on the geometry.

For controlling it, your hands will be occupied so you will need one of:
- USB microphone (if you want to experiment with voice control)
- USB pedal (if you want to make it foot-activated)

I've linked to Adafruit for several of these. But you might want to find them someplace more local.

That should be all the electronics you need. Now let's talk rig. I have
a kind of wooden scaffold to attach everything to. I am not that handy
when it comes to building things, but I've been able to do ok with some
pre-cut pieces of wood and a drill. Building something like this would
be one option for you.

Another one would be to take an existing copy stand which already has a
mount for your camera and figuring out how to attach lasers and lights
to it.

duerig
Posts: 380
Joined: 01 Jun 2014, 17:04
Number of books owned: 1000
Country: United States of America

Re: Laser Scanning Results

Post by duerig » 17 Oct 2014, 11:50

I should point out that I am a raw beginner when it comes to electronics and wood construction. On the one hand, this has meant that I have spent far too much time with various bad designs for my prototypes. But on the other hand, almost anybody should be able to build something similar to what I have now.

For anyone who wants to start building a prototype rig now, I'm happy to help you get it going. Now that I am satisfied that this is a viable way to scan books, the main objective is to make it practical and useful for everybody who wants to try it out.

At some point in the future, I am certain that there will be kits designed by people who actually know what they are doing (like Daniel). And I will be integrating my dewarping software into Spreads as well. The goal is to get to a point where there is an cheap, easily assembled, portable laser scanner which just works via the web interface for Spreads.

User avatar
dingodog
Posts: 106
Joined: 22 Jul 2010, 18:19
Number of books owned: 1000
Country: on the net
Location: on the net
Contact:

Re: Laser Scanning Results

Post by dingodog » 17 Oct 2014, 18:30

many thanks, a valuable post

thanks for spending your time to made this useful checklist

regarding the laser, in my country are only allowed 1 milliwatt powered laser; it is enough or not?

duerig
Posts: 380
Joined: 01 Jun 2014, 17:04
Number of books owned: 1000
Country: United States of America

Re: Laser Scanning Results

Post by duerig » 17 Oct 2014, 18:45

I think a dimmer laser will still work. You may have to use a lower --laser-threshold value and in the worst case, you may need to reduce ambient light.

One thing to remember is that in the current workflow, the floodlights are turned off when you capture the laser shot. So the only thing that might wash it out is ambient light in the room. Even with the guide laser, the floods can be turned on just before taking a shot instead of being left on. This would let you align using the guide laser without it being washed out by the floods.

Bottom line is that we might have to tweak the software, but it should be doable. After you have things set up and capture a few sample scans, send them to me and we will see how to make it work.

Post Reply