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

Dekeystoning with a checkerboard

Share your process here - how to build something, scan something, or use something.
Post Reply
Shaknum
Posts: 91
Joined: 16 Aug 2010, 13:10

Re: Dekeystoning with a checkerboard

Post by Shaknum » 23 Jan 2011, 12:04

I have to second the idea of using special codes. Of course, this depends on how well this software can read them. A right and left page card would be nice for auto rotation, I'm not sure how a b/w or color card could be useful with something like ScanTailor, but I imagine people are thinking of using this with other solutions. I know we've talked at points about manually writing ScanTailor config files, if I have time I'll look into it since I can easily do that (Java was my first language [what a shame, huh?]).

On another note, I've been using this software for a bit and the Java QR-code version is much more robust than the checkerboard alignment, and it is really pretty quick. Also, you can multithread this from the command line (*nix) thus:

Code: Select all

 java -Xmx512M -jar ~/Downloads/qrpc-1.4/qrpc.jar ./Left > left.log & java -Xmx512M -jar ~/Downloads/qrpc-1.4/qrpc.jar ./Right > right.log && echo "done"
I don't think Java does any automatic optimization for multithreaded processors, so this will speed things up.

User avatar
Gerard
Posts: 154
Joined: 17 Oct 2010, 07:15
Number of books owned: 0
Location: Berlin (Germany)

Re: Dekeystoning with a checkerboard

Post by Gerard » 25 Jan 2011, 10:08

Hi,
how many dpi do the qr-code image have? QR registration image.jpg

i have problems with my programs to print it in the right scale,

why it hast to be printed in 100%?

Shaknum
Posts: 91
Joined: 16 Aug 2010, 13:10

Re: Dekeystoning with a checkerboard

Post by Shaknum » 25 Jan 2011, 11:41

Gerard wrote:Hi,
how many dpi do the qr-code image have? QR registration image.jpg

i have problems with my programs to print it in the right scale,

why it hast to be printed in 100%?
steve1066d wrote:The barcodes should 4" x 4" to the outside edges. The code itself uses the upper right corner of each of the QR codes, which are 3" apart.

If you print it with something that recognizes the DPI, it should print that size automatically. I printed it with IrfanView.

Steve
Ich habe das QR-Bild ausgedruckt und die Barcoden sind 4" vom links Rand bis zum rechts. Ich glaube das es arbeitet perfekt. Ich habe ein Buch photographiert, und in meiner meinung waren die Bilder 510 PPI, aber dieses Programm hat gesagt dass Sie 518 PPI sind. Das ist doch ein bisschen besser. Ich bin auf Mac und ausdrucke mit "scale: 100%", das sollte auch Ihnen arbeiten (Benutzen sie Linux mit Ghostscript?). Es tut mir leid dass mein Deutsch so schlecht ist, aber ich meine dass es besser als Englisch ist. Duzen wir, wir sind alle freunde hier.

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: Dekeystoning with a checkerboard

Post by steve1066d » 25 Jan 2011, 12:49

The image is 300 DPI.

The key measurement is that the distance upper left corner of the upper left barcode to the upper left corner of the upper right barcode should be 3 inches.
Steve Devore
BookScanWizard, a flexible book post-processor.

zamacam
Posts: 20
Joined: 04 Mar 2014, 00:53

Re: Dekeystoning with a checkerboard

Post by zamacam » 01 Feb 2011, 17:22

Just for information, qrpc sometime fails to detect a key image. I finally found a possible reason: exposure is too slow. If I modify the supposed white background to pure white, qrpc finds the key image.

I'm attaching two images as example if someone what to do some tests.
Attachments
modified.jpg
original.jpg

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: Dekeystoning with a checkerboard

Post by steve1066d » 01 Feb 2011, 20:44

Rob,

I was doing work with expanding the qr-code support in BookScanWizard, and I had found out that it is really best to do your own binarization instead of using the zxing's hybrid or global ones.

The problem with the global one is it looks over the image and sees all the black around the borders, and tries to lighten it too much. And if you use the supposedly better hybrid one, it can fail on high resolution images where the borders of the barcode are big enough to confuse it.

But a plain dumb constant works pretty well. Since for book scanning, we are starting with reasonably exposed images, it isn't hard to pick a threshold that works consistently. (I'm using as a default 118, which is the supposed color of a "gray card").

I tried it on zamacam's image and it worked fine.
Steve Devore
BookScanWizard, a flexible book post-processor.

Shaknum
Posts: 91
Joined: 16 Aug 2010, 13:10

Re: Dekeystoning with a checkerboard

Post by Shaknum » 02 Feb 2011, 01:29

I've been using this pretty avidly for a while now, and love the functionality. I did, however, just notice that the warping algorithm is not as clean as what you find in photoshop or Gimp (e.g., lines that were slanted and were fixed to be straight have jagged edges now). I'm going to take a look and see if I can find a way (i.e. some other library) to raise the quality of the (de)warping. I believe the actual (de)warping takes place PerspectiveOp.java, though I don't understand everything going on in there. Thanks again for the great work, this thing is a real time saver.

Shaknum
Posts: 91
Joined: 16 Aug 2010, 13:10

Re: Dekeystoning with a checkerboard

Post by Shaknum » 02 Feb 2011, 01:48

The problem is that we are using "nearest neighbor" when we really need something like bilinear or bicubic scaling. When I try to select either of those in line 353 of main.java, the program crashes. I'll keep looking...

User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: Dekeystoning with a checkerboard

Post by rob » 02 Feb 2011, 10:08

Yeah, I didn't implement those types of perspective. Java doesn't have a perspective operation, so I had to write it myself. The JAI does, but I hate the JAI.
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.

Shaknum
Posts: 91
Joined: 16 Aug 2010, 13:10

Re: Dekeystoning with a checkerboard

Post by Shaknum » 02 Feb 2011, 17:44

It looks like we could do this with the java 2D API, which I believe also allows openGL acceleration. I'm just trying to figure out exactly what parameters we would need to pass to the PerspectiveTransform or WarpPerspective class. You are right that the JAI is a nightmare, and in many ways java sucks. But, it's just so quick and easy to use.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest