BookScanWizard 2.0

Discussion about Steve DeVore's Book Scan Wizard, a power-user package to automate scan processing.

Moderator: peterZ

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: BookScanWizard 2.0

Post by steve1066d »

Here's what I came up with for that page:

Code: Select all

# Book Scan Wizard Script 
# http://bookscanwizard.sourceforge.net

# *** Load Files ***
# the source directory
LoadImages = .
# The Destination directory
SetDestination = output

# *** Page Rotations ***
Pages = all
Rotate = -90

# *** Remove Pages ***
# *** Perspective ***
# *** Crops ***
Pages = all

Crop =  1328,1022, 3176,3850

# *** Filters ***
Pages = all
Levels = 20,73.3, 19.6,70.6, 10.2,54.5
Color = gray
MedianFilter = 5
Color = bw 60

# *** Scaling ***
Pages = all

# *** Output ***
Pages=all
SaveImages = png
The issue might be that the crops checkbox should be checked so that the Auto RGB Levels works correctly.

Also if you are inserting config using the right-click menu from the viewer, pay attention to where it is putting the code. The logic works well for adding new config, but if you are inserting it afterwards, it doesn't always put the code where you would like it. The order I have it above is probably the best way: You crop it, then run Auto RGB levels, then turn it to gray, then run the median filter, then convert it to black & white.

I'll take a look at why the decimals still are a problem...
Steve Devore
BookScanWizard, a flexible book post-processor.
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: BookScanWizard 2.0

Post by steve1066d »

You should have access to the wiki... I gave all authenticated users access to it (no need to make people go through hoops if they want to add to it)

I probably should make the AutoRGB Levels smart enough so it can work without clicking the "Crop" button, but for now to work with filters, you should have that button enabled.

Perspectives can go weird if you try to do multiple perspectives on the same page, or else if you add a rotation before the perspective.

Also make sure when you click on the corners you start in the upper left corner and work clockwise.

The slowdowns are stange. I see under a second response when working with that image you are using. If you see a pattern, let me know. I'll also try to think of some debugging I can add for you.

I think I found all the cases I needed to change to force to decimal mode. I was able to set my locale to Hungary and it now works.

I've updated it to 2.0.2b
Steve Devore
BookScanWizard, a flexible book post-processor.
User avatar
kempelen
Posts: 18
Joined: 07 Feb 2012, 18:19
E-book readers owned: -
Number of books owned: 1000
Contact:

Re: BookScanWizard 2.0

Post by kempelen »

Another thing, before I forget:
./bsw
Error: Unable to access jarfile ./bsw/../BookScanWizard.jar

I always need to modify the bash script to remove "$0/../" part and keep only the file name alone.

Re latest update:

Did you add any extra package requirement in this update? I can run my older 2.0.1a, but 2.0.2b local copy shows:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/jai/TileCache
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: javax.media.jai.TileCache
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more

On webstart:

net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: Could not initialize application. The application has not been initialized, for more information execute javaws from the command line.
at net.sourceforge.jnlp.Launcher.createApplication(Launcher.java:779)
at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:513)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:917)
Caused by: net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Unknown Main-Class. Could not determine the main class for this application.
at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:708)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.<init>(JNLPClassLoader.java:249)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.createInstance(JNLPClassLoader.java:382)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:444)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:420)
at net.sourceforge.jnlp.Launcher.createApplication(Launcher.java:770)
... 2 more

Hmm... from javaws output:

Attempted to download http://bookscanwizard.sourceforge.net/r ... Wizard.jar, but failed to connect!
JAR http://bookscanwizard.sourceforge.net/r ... Wizard.jar not found. Continuing.
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: BookScanWizard 2.0

Post by steve1066d »

It looks like I broke Webstart... I won't be able to fix it for another hour or so.. .sorry about that.
Steve Devore
BookScanWizard, a flexible book post-processor.
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: BookScanWizard 2.0

Post by steve1066d »

Actually, I was able to get into it and fix it from work, so give it another try.
Steve Devore
BookScanWizard, a flexible book post-processor.
User avatar
kempelen
Posts: 18
Joined: 07 Feb 2012, 18:19
E-book readers owned: -
Number of books owned: 1000
Contact:

Re: BookScanWizard 2.0

Post by kempelen »

Do you think negative coordinates are OK in any cases?

Crop = 1150,-3457, 3154,-248

I get such things for simply marking an area on the page and Crop. Especially when I try to open my original project. If you could to take a look please, I've uploaded the whole thing as gozgep2.tar on URL below (300MB). This negative coordinate occurs also when creating a new project over that dir and also when opening the existing bsw file. May be related to some files there, or the barcode file or I don't know...

http://c64.rulez.org/~lion/bookscanner/bsw/

And with gray, using the 24.JPG image from my previous link and exactly your configuration, with one image in "source", it still whites out the image on command Gray. A full screenshot so you can check if all are similar to your test:

http://c64.rulez.org/~lion/bookscanner/bsw/bsw202b.png

And a minor bug:

When you create a new project that creates a left-right configuration, but if there is only one image, that throws this exception at start:

BSW There are 4 processor(s), 2 667M, 4 threads
[destination_dpi=300],[working_directory=/home/lion/CDRE/bookscanner/egyeb/gozgep3],[destination_directory=tiff],[use_focal_length=false],[right_orient=90],[source_directory=source],[use_barcodes=false],[override_source_dpi=],[output_type=B/W],[compression=NONE],[left_orient=-90],[file_format=TIFF]
color: B/W
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:834)
at net.sourceforge.bookscanwizard.op.Rotate.setup(Rotate.java:71)
at net.sourceforge.bookscanwizard.Operation.getOperation(Operation.java:358)
at net.sourceforge.bookscanwizard.Operation.getOperations(Operation.java:85)
at net.sourceforge.bookscanwizard.BSW.getConfig(BSW.java:344)
at net.sourceforge.bookscanwizard.gui.GuiActions.newBatch(GuiActions.java:538)
at net.sourceforge.bookscanwizard.gui.GuiActions.cursorActionPerformed(GuiActions.java:168)
at net.sourceforge.bookscanwizard.gui.UserFeedbackHelper.actionPerformed(UserFeedbackHelper.java:47)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)

(So: make a source dir with 1 image, then File->New and complete that dialog. If there are two images, this does not happen. Rare setup, but surprised me when trying to reproduce your test.)

The RGB levels thing now creates correct decimal points, thanks for the update!
User avatar
kempelen
Posts: 18
Joined: 07 Feb 2012, 18:19
E-book readers owned: -
Number of books owned: 1000
Contact:

Re: BookScanWizard 2.0

Post by kempelen »

Do you mainly run the 32 or the 64 bit version? I'd use the same to avoid differences. I did these latest tests with 64bits.
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: BookScanWizard 2.0

Post by steve1066d »

Thanks for posting the entire project... That helped.

Your old question about the SetPreviewScale not seeming to help much is because I took that out early on. (While it would be a worthwhile feature, I was having troubles keeping the coordinates in sync).

I use the 64 bit version.

The negative coordinates are an issue.. The issue was that the Left perspectives were missing StartPage entries. Without that start page it will do the perspective on all of the pages that match the last Page setting. so that first left perspective correction would be applied to all left pages, and then it would apply a another perspective on top of that. I redid the left perspective corrections for you. It would also account for the slow rendering.

I think I misunderstood a previous question of yours on rotations... If you are doing small adjustments to the rotations, its easier to just do it as part of the perspective correction. But to rotate the page to the right direction, is easier to use a rotate. In cases where you do a rotate before perspectives, it works best to use 90, -90, or 180 degrees.

If you use barcodes, its a good idea to right click on the Barcodes line in the config, and chooose "Expand barcode operations" That will let you see the config that the barcodes is doing.

When starting with a new book, choose the pages you want to do the perspective corrections on (click on the 4 corners, then right click and choose perspective).

Once you've finished with the perspective calculations, click the Perspective preview button.

Next, do the crops.

Once you've got the crops the way you want, press the Crops and Filters checkbox, and then work on the filters.

I did notice that if a crop is done the filter dialog doesn't show the entire cropped image. I'll try to fix that.

Try using this config as-is and see if you still have the issue with using the gray filter.

Code: Select all

# Book Scan Wizard Script 
# http://bookscanwizard.sourceforge.net
#   C:\gozgep2


# *** Load Files ***
# the source directory
LoadImages = source

# The Destination directory
SetDestination = tiff

# *** Page Rotations ***
Pages = left
Rotate = -90
Pages = right
Rotate = 90

# Use barcodes.csv to define operations 
# Barcodes = 
Pages = all
SetSourceDPI = 592 # 00a L

Pages = all
RemovePages = 00a
# End barcode configured operations

# *** Remove Pages ***
# *** Perspective ***
Pages = left
Perspective =  1343,1005, 3028,1018, 3015,3449, 1339,3445
StartPage = 14
Perspective =  1024,746, 3160,763, 3133,3923, 1041,3918
StartPage = 24
Perspective =  1422,1151, 3111,1147, 3115,3582, 1447,3603
StartPage = 30
Perspective =  1464,1084, 3015,1043, 3073,3574, 1505,3603
StartPage = 34
Perspective =  1414,1105, 3073,1097, 3115,3674, 1439,3703
StartPage = 36
Perspective =  1535,1243, 3023,1218, 3053,3561, 1555,3574
StartPage = 42
Perspective =  1234,1314, 2907,1343, 2898,3670, 1222,3653

Pages = right
Perspective =  96,227, 2338,227, 2310,3439, 74,3422
StartPage = 03
Perspective =  221,658, 1924,647, 1924,3178, 221,3189
StartPage = 07
Perspective =  136,392, 2264,409, 2247,3632, 108,3592
StartPage = 21
Perspective =  176,471, 2310,465, 2275,3666, 113,3643
StartPage = 33
Perspective =  142,465, 2264,460, 2241,3688, 113,3643



# *** Crops ***
Pages = right
Crop =  175,318, 2229,3331
StartPage = 01
Crop =  164,482, 2218,3495
StartPage = 21
Crop =  216,527, 2270,3540

Pages = left
Crop =  1017,753, 3070,3763
StartPage = 22
Crop =  1090,833, 3143,3842


# *** Filters ***
Pages all
Levels = 20.4,73.3, 19.6,70.6, 10.2,54.5
Color = gray
MedianFilter = 5
Color = bw 55


# *** Scaling ***
Pages = all
# Rescale the image to match the final DPI
ScaleToDPI=300

# This will ensure the left and right pages are exactly the same size.
ScaleToFirst=

# *** Output ***
Pages=all
SaveImages = TIFF NONE
Steve Devore
BookScanWizard, a flexible book post-processor.
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: BookScanWizard 2.0

Post by steve1066d »

If you haven't seen it already, this would be a good video of BSW to take a look at:

https://www.youtube.com/watch?v=GbMgpsVA1Ss
Steve Devore
BookScanWizard, a flexible book post-processor.
User avatar
kempelen
Posts: 18
Joined: 07 Feb 2012, 18:19
E-book readers owned: -
Number of books owned: 1000
Contact:

Re: BookScanWizard 2.0

Post by kempelen »

Hi Steve!

OK, for some weird reason I thought that "Pages" with increasing start numbers is equivalent to "StartPage" sequences. And I thought there is a kind of "specificity", the best match works from the Perspective commands. Despite seeing the warning in the documentation.. sorry about that.

The video is very cool, thanks! I had a bookmark - but forgot to watch it. Now I understand how the red marker works!

For rotation: you understood the question right. My configuration had a forgotten test value. Basically the whole configuration was a mess after trying all kind of things. :-(

I didn't know I can expand barcodes, thanks! Do you think my DPI barcode is right: 8cm x 7.6cm? The calculated DPI looks fine, I calculated the about the same manually.

For gray: still totally kills the page.

For "scale to dpi", I think it's better to scale a gray images than b&w ones, so if the program allows, I think people should scale first and then apply the b&w. Especially if I scale upwards, because I found that I can gain some quality by scaling upwards on gray, you can see an example of that here, section "Scaling before thresholding" http://potrace.sourceforge.net/mkbitmap.html (I'd rather scale this 590 DPI book to 600 than to 300.)

Thanks for all the help! There were no big mistakes in my Hungarian intro article, but I'll definitely update it now with small fine details and link to the video!
Post Reply