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

DIY Book Scanner Skunk Works. Share your crazy ideas and novel approaches. Home of the "3D structure of a book" thread.
Anonymous1

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by Anonymous1 » 12 Feb 2011, 17:44

Well, we can't see it ;)

steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by steve1066d » 12 Feb 2011, 18:26

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 post-processor.

Anonymous1

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by Anonymous1 » 12 Feb 2011, 21:41

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.
canvas.png
After
The attachment canvas.png is no longer available

User avatar
daniel_reetz
Posts: 2786
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: Methods To Sense The 3D Surface/Structure Of A Book

Post by daniel_reetz » 12 Feb 2011, 22:57

Wow, those are some straight laser lines!

:twisted:

atarkri
Posts: 14
Joined: 08 Jan 2011, 13:29

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by atarkri » 12 Feb 2011, 23:22

"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 scale-invariant 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:
CIMG0918.JPG_morphclose_laser_explanation_small.jpg
CIMG0918.JPG_morphclose_laser_explanation_small.jpg (116.18 KiB) Viewed 3763 times

L0g1cM0del
Posts: 17
Joined: 04 Mar 2014, 00:53

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by L0g1cM0del » 12 Feb 2011, 23:44

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 over-warping 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

Anonymous1

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by Anonymous1 » 13 Feb 2011, 10:09

I have access to basically every possible closed-source 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 laser-finding 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...

Anonymous1

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by Anonymous1 » 13 Feb 2011, 11:01

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:
canvas.png
Algorithm 1
canvas2.png
Algorithm 2
Much better. I'm still plowing through those research papers...

Anonymous1

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by Anonymous1 » 13 Feb 2011, 12:13

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):
render2.jpg
Transformation
render2.jpg (109.12 KiB) Viewed 3722 times
To dewarp, I think I'm going to try using affine transformations by subdividing them image into little squares (this is a really low-poly 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
render.jpg
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.

andigit

Re: Methods To Sense The 3D Surface/Structure Of A Book

Post by andigit » 13 Feb 2011, 12:20

atarkri wrote:
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.
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}.
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.

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 x-axis (x = left/right, y = up/down, z = depth). If I am not rotated about the x-axis, 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 y-axis 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.
Image

Then the Z-axis... if we are rotated about the z-axis it will look like the first. If we are not it should look like the 2nd picture.
Image

Then for X-axis... 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.
Image

Sorry for the long post.

Anonymous/steve you would need this information to get the accurate height right?

Post Reply