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.

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

Postby Anonymous1 » 24 Feb 2011, 13:36

If only I could figure out how to use PIL's ImageTransform function (PIL is Python's stripped-down image processing library), as it can input a mesh.

But it's horribly slow (OpenCV charges through the images in under a second, but PIL takes up those 10 seconds when doing the actual warping), so I'll have to play with OpenCV a bit more...
Anonymous1
 

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

Postby steve1066d » 24 Feb 2011, 15:27

I was thinking about the camera calibration, and I think that using a checkerboard isn't a good idea (or at least not the best). I'm going to try to make a GUI application (or if one exists, I'll just use that) and manually dewarp a few images to find the distortion coefficients and the camera matrix.


You might want to check out Hugin:

http://hugin.sourceforge.net/tutorials/calibration/en.shtml
Steve Devore
BookScanWizard, a flexible book post-processor.
steve1066d
 
Posts: 236
Joined: 27 Nov 2010, 02:26
Location: Minneapolis, MN

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

Postby daniel_reetz » 24 Feb 2011, 15:42

http://wiki.panotools.org/Fulla is the lens correction part of Hugin. You'll probably want the full Hugin interface to work with it at first. Spam and I were playing with Hugin for lens calibration - it's definitely doable, and there's a good tutorial out there by Bruno Postle (can't find it using my phone, unfortunately)
User avatar
daniel_reetz
 
Posts: 2485
Joined: 03 Jun 2009, 13:56

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

Postby Anonymous1 » 25 Feb 2011, 12:21

After playing with Hugin for an hour, I have concluded that it is not very useful for this sort of stuff...

The calibration produces worse results than what I get by manually doing it with a slider in GIMP. Dan, have you had any reasonable radial dewarping output come out of Hugin or it's CLI tools?
Anonymous1
 

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

Postby andigit » 27 Feb 2011, 02:53

Been so busy but wanted to share what I have for lens distortion correction so far...

Image
Larger: http://tanoshi.smugmug.com/photos/1199794641_8mRze-O.png

The blue line are the deformed lines. I'm actually calculating backwards from what Anonymous and Steve are doing? This method actually makes it easer to do bilinear/bicubic operation easier since I know where the pixel for fixed x,y is coming from.

Haven't committed the code but I'm getting close... hopefully sometime in the next few days.
andigit
 
Posts: 21
Joined: 25 Aug 2009, 16:54

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

Postby steve1066d » 27 Feb 2011, 02:56

Actually, I'm doing the reverse warp.. Anonymous is doing the forward warp though.
Steve Devore
BookScanWizard, a flexible book post-processor.
steve1066d
 
Posts: 236
Joined: 27 Nov 2010, 02:26
Location: Minneapolis, MN

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

Postby TomHorsley » 27 Feb 2011, 08:34

Anonymous wrote:As I don't have access to a machine with compiling capabilities (I'm on a Windows rig)


If you have the disk space and the bandwidth, you can download mingw and get a windows compile environment:

http://www.mingw.org/wiki/InstallationHOWTOforMinGW

(though as I type this, that link isn't responding, maybe the wiki is down at the moment).
TomHorsley
 
Posts: 92
Joined: 30 Jan 2011, 10:39

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

Postby Anonymous1 » 27 Feb 2011, 22:05

That links isn't working for me either...

I'm back to my lovely Linux rig, so compiling is a breeze again. I'm probably going to switch to C++/C as soon as possible, as Python is getting a bit slow to run, and it's hard for people to use (binaries seems to be the stuff, even if they requires beating a dead horse multiple times).

I'm actually going to use your program, andigit. I was going to make one like that in Python and Qt4 (without the grid. I'm pretty bleh when it comes to GUI programming), but your C++ implementation seems to be pretty sweet (and I might as well steal your compiling code too; I can't figure out all this "make" nonsense, even though I've edited way too many Makefiles).
Anonymous1
 

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

Postby andigit » 27 Feb 2011, 22:40

Anonymous, Please do :) power of open source

And the barrel correction is finally alive!!! woot! The example is set at a extrem to show its working :)
Image
original: http://tanoshi.smugmug.com/photos/1200776193_d6dgg-O.png

The grid, lines up with top and the bottom image (corrected image on bottom).

Code isn't really clean but I got it pretty fast. Calculation and generating the image is almost instant now.

All the interpolation seems to be working. Right now I have nearest neighbor, Bilinear, and Bicubic implemented.

Sorry no binary but should be easy to compile. Was playing with exif data but I pulled the code out for now.
andigit
 
Posts: 21
Joined: 25 Aug 2009, 16:54

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

Postby Anonymous1 » 28 Feb 2011, 01:44

Yep, just a quick set of commands and it's up and running:
Code: Select all
git clone git://tanoshi.sourcerepo.com/tanoshi/BookCorrection.git andigit_dewarp
cd andigit_dewarp/BookCorrection/
mkdir build
cd build
cmake ..
make -j 4
./BookCorrection


The line detection is really good (mine used to die when the image had tons of noise, but a median blur filter took care of that), so the dewarping should benefit from that. The only big problem I faced was when I tried to load a full-sized image into your program: it froze for literally 5 minutes, and then loaded the image.

Your laser detection works really well. How do you do it (mine gets sloppy near the crease, and I can't read C++ very well, so I can't find out >.< )?
Anonymous1
 

PreviousNext

Return to R&D and New Technologies

Who is online

Users browsing this forum: No registered users and 0 guests