Page 7 of 9

Re: Dekeystoning with a checkerboard

Posted: 06 Feb 2011, 23:19
by daniel_reetz
Oops, I meant to link to this. Might help.

Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 00:12
by steve1066d
I don't see how you use your program. There doesn't seem any great set of instructions for barcodes on the wiki,website, or these forums.
I agree, Barcodes were only really incorporated a week or so ago, and I'm slowly getting the documentation to where it needs to be.

If all you want to do is correct keystoning from the command line, look here: ... t=50#p8404

But I'm assuming you are really looking to do other things with BSW.. so read on...

1) What is the difference bewteen Barcodes and BarcodePerspective
Short answer: Use Barcodes. Long answer: BarcodePerspective is an internal command that Barocdes uses. It differs from a normal perspective correction in that it assumes that the barcodes are square, while the normal perspective only assumes that the selected area is a rectangle.
2) I can print out the barcodes, but where do I put them? At the beginning of the book and then take a picture of those pages? Can it differentiate between left/right barcode pages?
For every barcode except the perspective barcode you can put them anywhere that will be picked up by the camera. The perspective barcode should be placed so that it lines up with the text.
For the perspective barcode you would normally place that at the beginning and whenever the perspective has changed. The other barcodes can be used where they make sense. (Like if you want to redo the page you just scanned, put down the "redo page set"), take a picture, then take another picture of the previous page.

It can't differentiate between left & right. It assumes that when you create "l" and "r" directories you put the right files in the right directory. If you do goof up and get it backwards, just rename them and try again.

I did consider making it smart enough to know the difference, but I figured that I had just as much chance of putting the code on the wrong page to begin with, as I did for putting the wrong card in the reader to read them. However, I'm open to adding a that as a feature, if it makes sense in some scenarios.
3) Should the barcodes span the entire page? When I print them out they only occupy about a 4x4 box at the top-left of a 8.5x11 in paper
No.. they are sized so they can be easily scanned, but small enough so they will always fit even if scanning a small book. The software will find it regardless how big or small it is (within reasons).
4) Do you have to use the -barcodes flag from the command line or can you just input it in the script area and then hit "submit"
I think it makes sense to do it ahead of time using the -barcodes or -split flags, but in the version I released 1/2 hour ago it will let you scan them from the gui as well. The challenge is that if you are running it interactively, you really need all the barcodes scanned before you can do the cropping and other tweaking. However, it does take a while to process all the barcodes, so if you run them from the gui you have to start BSW, read the barcodes, and come back 10 minutes later.
5) Any chance to use a gui dialog rather than having the user type in commands?
I've got the wizard to get started, and if you right click in the viewer it does the most common stuff without much typing at all. One problem with doing a gui is that it would limit what could be done. There's a general order that things are done in, but I find that I sometimes modify it depending on what I'm trying to accomplish. If I use dialogs I looks that flexibility. You can also double-click rows in the command helper and it will insert the command in the configuration.

However, that doesn't mean that there isn't a value for a dialog, and maybe both could co-exist. A dialog approach for standard options and an "expert" setting that is completely configurable. However, the the reality is that designing GUI forms is a bit too much like my day job to be interesting for me, so given a chance of doing that or adding some new cool feature , the cool feature will probably win out :)

In any case, once you use it for a while, you'll get past the challenge of the text configuration.. hang in there.
I haven't got it to run yet. Either I get "array out of bound errors" and I am looking at the command syntax or the output is identical to the input
If you are running interactively, ensure that either the "to cursor" checkbox is unchecked, or that the text cursor in the configuration is at the end of the configuration you are trying to add.

If this is when you run with the -barcode flag, I think this is a bug that has already been fixed. See if the current version works better for you (0.9.8).
If you still have problems, this could be a problem with the configuration. The array index out of bounds most likely means that there's a required configuration parameter missing. Could you maybe post or send me a copy of the configuration?
, though it does seem to do a decent job with fixing the presepective. The only problem I see is that the book will shift slightly during scanning so applying a crop to all pages will likely clip some part of the page towards the end of the book.
If the perspective changes during the book you can adjust it, either by using a perspective barcode every hundered or so pages, or by doing it manually, using the Pages: command followed by the Perspective command.

Or if a change in cropping is all that is needed, that also can be defined for a set of pages.

I hope that answers everything. If not, let me know, and good luck.

Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 00:43
by o3h1p
Thank you steve. I'll have a second go at it.

Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 00:45
by o3h1p

Your QR code page is too big for small books. Can we just scale it down before print?


Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 01:29
by steve1066d
As far as scaling down the QR-codes from either Rob's program or BSW's .. yes you can scale them down but the calculated DPI will be off, though the perspective correction will work fine.

Though it isn't a problem if the codes overhang the book a bit, as long as the codes are on something rigid, as long as all four codes are in view of the camera.

Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 05:11
by Gerard
steve1066d wrote:Though it isn't a problem if the codes overhang the book a bit, as long as the codes are on something rigid, as long as all four codes are in view of the camera.
it would ne nice i the 4 qr-codes would have a 5th code in the middel or somewhere else where the dpi of the qr-code-card are encoded, this would allow to print a variation of the cards and to use maximal possible zoomlevel

Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 09:02
by steve1066d
The codes put out by BSW actually do encode the distance between the squares as part of the message... I just haven't gotten around to making a dialog to choose the size you want.

Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 09:40
by schaema
Hi Steve,
just got BookscanWizard running (took 2 cycle but after trying the CLASSPATH-Versions of JAI & JAITools I used the jre which seems to be a bit easier to install).
Nevertheless, now I'm trying to get up a script which works for my scanning process.
What I'm wondering: Where could I generate the "book 'title' starts here" Barcodes ?
In the custom-barcodes, I only found the 'end book" code.

Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 10:55
by steve1066d
The title barcodes actually encode the title of the book as part of the code. There's a text area on that dialog that you can enter a list of book titles, and it will print out a title barcode for each of them.

If you don't want to use the the book titles, then the "end book" barcode is the one to use.

Re: Dekeystoning with a checkerboard

Posted: 07 Feb 2011, 13:10
by o3h1p
Steve I think your instructions from this page ... t=50#p8404
still might be missing something:

1) bsw is only a windows batch file, correct? So in linux it's different.
2) I currently have the following structure


with a book.bsw file in ./ that contains:

Code: Select all

LoadImages = Lcamera
SetDestination = tiff
Barcodes = 
ScaleToDPI = 300
I've installed the dependent libraries that the README says I should. Then I use the command (from ./):

java -Xmx1024M -jar bsw/bin/BookScanWizard.jar -barcodes

It returns "Bad Parameters". I see that the -help flag returns some more info but it doesn't really show the syntax. It does show config_name, but it doesn't show the context, something like

"BookScanWizard.jar <config_name> [options]"

I do notice that it seems that -barcodes takes a directory flag (I assume no default? Does that mean that the instructions on the forum page above are incorrect?). So then I try:

java -Xmx1024M -jar bsw/bin/BookScanWizard.jar -barcodes ./Lcamera

I assume I point it to the directory that has the first image as a barcode (I'm trying to do keystone correction/dewarping)? It reads the codes but creates a zero-size barcodes.csv file and does not output anything to the tiff directory. Any idea what I might be doing wrong?