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
Methods To Sense The 3D Surface/Structure Of A Book

 Posts: 296
 Joined: 27 Nov 2010, 02:26
 Ebook readers owned: PRS505
 Number of books owned: 1250
 Location: Minneapolis, MN
 Contact:
Re: Methods To Sense The 3D Surface/Structure Of A Book
I was able to get a copy of that second paper and it looks like it was just a revised version of the first paper. It does have many of the same authors.
Steve Devore
BookScanWizard, a flexible book postprocessor.
BookScanWizard, a flexible book postprocessor.
Re: Methods To Sense The 3D Surface/Structure Of A Book
Thanks for the paper, Steve. I'm looking over it over and over...
I've straightened out those laser lines, and look how much better that book looks! Production quality, if I must say so myself.
I've straightened out those laser lines, and look how much better that book looks! Production quality, if I must say so myself.
 daniel_reetz
 Posts: 2786
 Joined: 03 Jun 2009, 13:56
 Ebook readers owned: Used to have a PRS500
 Number of books owned: 600
 Country: United States
 Contact:
Re: Methods To Sense The 3D Surface/Structure Of A Book
Wow, those are some straight laser lines!
Re: Methods To Sense The 3D Surface/Structure Of A Book
"Straightening the laser line" would only work in the case that the laser line was "parallel" with the lines of text, which it isn't in that image. Imagine that page flattened out, and notice that the green laser line crosses multiple lines of text.
We must instead view this laser line as a scaleinvariant measure of change in height across the page. The only information we glean is the rate at which the height is changing, and, if the camera is parallel to the lasers, that points across the curve have equal heights.
In a picture:
We must instead view this laser line as a scaleinvariant measure of change in height across the page. The only information we glean is the rate at which the height is changing, and, if the camera is parallel to the lasers, that points across the curve have equal heights.
In a picture:

 Posts: 17
 Joined: 04 Mar 2014, 00:53
Re: Methods To Sense The 3D Surface/Structure Of A Book
What if you were to run a tangent line to the maximum points of the curves of each of the segments that were parallel to the words on each page and have the dewarping only go up to the point of the tangent line to prevent the overwarping that is at the edges of the pages? Just thinking out loud.
Also, wouldn't it make a difference to where the angle of the laser was in position to the distortion of the lines on the page? I think it was gerard who pointed out that if the laser is directly overhead, the lines are straight on the page. So then would the change in angle of the height of the laser have to be taken in to consideration in relation to the height of the book for the difference in variation of line distortion? Hope that makes sense.
Has anyone heard of the math program Sage? It is written in python and is supposed to be comparable to Mathematica. It says it has image processing tools. It may be something useful in testing out formulas.
http://en.wikipedia.org/wiki/Sage_%28ma ... oftware%29
Also, wouldn't it make a difference to where the angle of the laser was in position to the distortion of the lines on the page? I think it was gerard who pointed out that if the laser is directly overhead, the lines are straight on the page. So then would the change in angle of the height of the laser have to be taken in to consideration in relation to the height of the book for the difference in variation of line distortion? Hope that makes sense.
Has anyone heard of the math program Sage? It is written in python and is supposed to be comparable to Mathematica. It says it has image processing tools. It may be something useful in testing out formulas.
http://en.wikipedia.org/wiki/Sage_%28ma ... oftware%29
Re: Methods To Sense The 3D Surface/Structure Of A Book
I have access to basically every possible closedsource program that money can buy. The university I go to just felt an urge to purchase Mathematica, Maple, Abobe Master Collection CS5 (that's like $5,000 a copy), etc. for every single one of their 1,000 brand new iMacs. Such a waste, but I'm not complaining...
I was just playing around with the images, but these images are pretty good proof that my laserfinding algorithm needs some work. If you look at the accuracy near the crease of the book, it's horrible. A few of the research papers actually created a whole new algorithm just for accurately approximating the shape of the book near the crease, even with an actual 3D scanner. For now, I'm still playing with the lasers. I have a 3D model, but it's pretty much useless unless I can do something with it.
Back to the notebook...
I was just playing around with the images, but these images are pretty good proof that my laserfinding algorithm needs some work. If you look at the accuracy near the crease of the book, it's horrible. A few of the research papers actually created a whole new algorithm just for accurately approximating the shape of the book near the crease, even with an actual 3D scanner. For now, I'm still playing with the lasers. I have a 3D model, but it's pretty much useless unless I can do something with it.
Back to the notebook...
Re: Methods To Sense The 3D Surface/Structure Of A Book
I've updated the algorithm for finding the laser lines. Now, it's pretty much failproof. It iterates pixel by pixel vertically and checks if the pixel is white. If it is, it appends it to an intersection list and moves on. In the end, it averages the first and last elements to find the median of the line, which seems to work well. The problem was that the algorithm died when there was no laser line. Now, it just appends the previous value if there seems to be no line.
Here's the difference: Much better. I'm still plowing through those research papers...
Here's the difference: Much better. I'm still plowing through those research papers...
Re: Methods To Sense The 3D Surface/Structure Of A Book
I have a 3D model of the book, and it's looking pretty workable. Here's a render of the wireframe (the horizontal lines were not present. I added them via loop cuts):
To dewarp, I think I'm going to try using affine transformations by subdividing them image into little squares (this is a really lowpoly model. The real one has 1,000,000 squares) and finding the corresponding point on a flat plane with those subdivisions. Then, I'll just move the square onto the plane, skewing it along the way if needed. Attachments

 Book wireframe
 render.jpg (23.76 KiB) Viewed 3723 times
Last edited by Anonymous1 on 13 Feb 2011, 12:21, edited 1 time in total.
Re: Methods To Sense The 3D Surface/Structure Of A Book
I agree and there is probably away to figure out the camera position based on the green light. This is the goal for all of us but at the moment I'm not sure how to do this.atarkri wrote:This approach would be less useful in the general case (camera placed wherever), but may give higher quality results. Please go forward with this, and be sure to ask Dan if you need any {test equipment/ pictures satisfying those restraints}.andigit wrote:I need to assume that camera is parallel and perpendicular to the laser line. If i know the angle I think I can calculate this into the algorithm.
However, I think I came up with a good way to calibrate for the rotation. If I have 1 image with a object laid all the way a across with a know height, I can figure out how much i am rotated about the xaxis (x = left/right, y = up/down, z = depth). If I am not rotated about the xaxis, the top line should move the equal distance as the bottom line. If my top of the camera is tilted down the top line should move up more then the bottom line. If I'm thinking correctly I only need to look at the center strip.
Then if I have another image with no object with 2 line touching. I should be able to figure out the rotation about the Z axis.
Then for yaxis I can use image 1 again to figure out how much the camera is tilted or rotated on the y axis. This one is the hardest as I have to account for X and Z rotation.
I was going to say 2x4 would work for the first image but the laser line will move up and down 2inch so you'll probably need a bigger wood. 2x4 would be a good way to see if your laser is setup to 45degree angle though. The ratio of height to vertical movement should be exactly 1:1 if the angle is 45 degree. meaning if the wood is 2 inch heigh, the line should move up/down 2 inches at the respected height with the line being 4 inch apart.
If the camera is tilted it should look like the top image and if we have no rotation on y axis it should look like the 2nd picture.
Then the Zaxis... if we are rotated about the zaxis it will look like the first. If we are not it should look like the 2nd picture.
Then for Xaxis... if we are rotated it will look like the top. if not the bottom. I think you can look at the center line moving up and down to figure this out. Don't care about the edges as the tilt will be the same where ever you go.
Sorry for the long post.
Anonymous/steve you would need this information to get the accurate height right?