Page 31 of 36

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

Posted: 28 Feb 2011, 10:28
by andigit
Not sure why it took a long time to load, possibly my 3D calculation that pre-calculates height information for all pixel. Technically I should be loading the image in another thread so the ui event doesn't get blocked. I'll eventually get around to it.

The line detection is kind of messy. I'm almost doing a HSV/HSI checking manually. I started implementing hsv but did not finish implementing it. My plan was to use both and merge the result to gather.
https://tanoshi-apps.sourcerepo.com/red ... Runner.cpp

This code deals with the detection. There's a function at the bottom that detects the color and later finds the brightest green point.

Also everything in my code is threaded. Each scanline is handled by a thread, so it should be pretty fast at what its doing. The only thing that isn't multithreaded is the 3D calculation. I will eventually multithread this thing as well.

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

Posted: 28 Feb 2011, 19:44
by steve1066d
Well, I got part of it today.. Unfortunately, just the two uprights. Hopefully the real goodies are coming tomorrow.

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

Posted: 28 Feb 2011, 19:58
by Anonymous1
I've been playing with it, and the red lasers are really easy to work with. The bean's center is almost pure white, so all I had to do to extract the lasers was to threshold the red channel of the image.

As for the dewarping, I am going to redo a lot of the code. I want it to work only with a set of three images, and no user-defined values: a calibration image, an input laser image, and a laser-less image.

How's your dewarping going, Steve?

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

Posted: 28 Feb 2011, 20:48
by steve1066d
I'm pretty happy with where I'm at with my code.. Over the weekend I tidied it up so I'm pretty much ready to try it out with the lasers.

The approach I"m going to use is take a few calibration images, using QR codes. The first one will be on the base, the second one probably on a section of 2x4, and a final one with stacked 2x4 (so more like a 4x4). Then I'll use those images to determine the camera height, laser angle, image rotation, etc.

Then I'll probably scan a full book, with a laser image taken every 10 pages or so and see how well it works.

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

Posted: 28 Feb 2011, 22:51
by anonymous1
I'm in the process of using OpenCV's image mapping functions to create my dewarping grid. PIL is just way too slow, and it can't interpolate. Here's a quick test I did for radial dewarping:
Python's Imaging Library takes > 20 seconds to radially dewarp an image (without interpolation).
OpenCV's camera calibration: a fluid animation of dewarping the image, starting from k=0 to 1, with a step size of 0.00001.

I'm hoping to get almost realtime dewarping ;)

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

Posted: 01 Mar 2011, 03:59
by andigit
20 sec per image? thats pretty slow. I tried the c++ implementation I have with a 8 mega pixel camera and its about .5 ~ 1 sec to correct image with bicubic interpolation. Although my bicubic algorithm seems to be broken at the moment... I'm getting weird artifacts some times.

Anyway I've been thinking what order to apply the image correction...
lens distortion -> key stone correction -> rotate/move image respect to laser -> book flattening.

Does this order makes since?

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

Posted: 01 Mar 2011, 09:02
by steve1066d
Anyway I've been thinking what order to apply the image correction...
lens distortion -> key stone correction -> rotate/move image respect to laser -> book flattening.
That's the order I'm using.. It seems to work the best.

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

Posted: 01 Mar 2011, 19:16
by steve1066d
Well I'm bummed.. no lasers today either. I got the package with the uprights yesterday but the main package is MIA.

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

Posted: 01 Mar 2011, 20:15
by daniel_reetz
That's really shitty. I built myself a copy of the system. If you don't get yours in a day or two, I'll have my neighbor overnight that one to you. Glad at least one has arrived.

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

Posted: 01 Mar 2011, 20:32
by steve1066d
Yeah, hopefully it will show up in the next couple of days.

Atarkri, or Anonymous, if you do some scans with your setup, I'd appreciate a copy to tide me over in the meantime.