I know it isn't free, but I've seen Photoshop CS2 selling on eBay for around $100, so it isn't necessarily exorbitant either. I thought I'd share a quick tutorial on the batch processing which is available in Photoshop to automate post-processing of DIY Book Scanner scans. While different people are using different hardware, these scanners tend to produce scans in which right-hand pages are generally consistent with each other as far as size, keystoning, illumination, etc.. The same is true for left-hand pages. The right-hand pages are usually not consistent with the left-hand pages, but Photoshop can help correct the inconsistencies.
I start by creating a new folder on my computer for the book. Within that folder, I create 5 sub-folders: RRAW, LRAW, R, L, and Both. I begin by loading the right-hand images from my camera's SD card to RRAW, and the left-hand images to LRAW. Then, I'll create a Photoshop action which will process the images in RRAW and write the processed images to R, and run that as a batch process to automatically process each page.
Begin by opening a regular page from the RRAW directory. I generally wouldn't choose the cover of a hardback book, because it will be a bit bigger than the pages you want to process. If the "Actions" panel is not visible, you can add it from the Window menu, or toggle it on with Alt-F9.
Click on the "Create New Action" button at the bottom of the "Actions" panel. It's the square-within-a-square next to the trash can.
That will open the "New Action" dialogue.
I give the new action a descriptive name ("Right"), and just for the heck of it, associate it with Shift-F2 as a hotkey. The set to which the action belongs remains "Default Actions". Click the "Record" button to begin recording the new action.
The first thing I want to do is rotate the page into an upright orientation. This is done from the "Image" menu.
Next, I want to get rid of that greywash background. There are many possible ways to accomplish this in Photoshop. I've seen folks contemplate taking a "blank" page, subracting it from a "white" page, and adding the difference to the target page. Or something like that. My own approach is quite a bit cruder: I just use a "Curves" adjustment.
And not a particularly sophisticated curve either.
Which yields this result:
It's not as washed-out as it appears, though there is obviously room for improvement. It's a bit brighter toward the edge than toward the center; maybe a gradient would fix that, but I'm blessed with low standards, and as it is it's good enough for me. Those whose standards are more exacting can work out this bit for themselves.
Now -- finally -- we're ready to address the keystoning. Photoshop CS2 was the first release which offered perspective correction, and this is the first time I've had occasion to use it. Choose the "crop" tool:
Drag a quick selection from corner to corner -- no need to be too precise, we'll refine it in a moment. Once the selection is made, click the "perspective" box in the toolbar to enable each of the corners to be dragged independently.
Now I zoom way in, scroll to all four corners, and drag my selection points into place.
Then zoom back out and see how it looks.
Looks okay to me (there's those standards again), so I press "Enter" to complete the perspective crop.
Bingo! Let's zoom in again and see what we have.
See? I told you it wasn't as washed-out as it looked. Nice crisp anti-aliased text on a nice bright background. Easy on the eyes. And it looks like it's lined up right, too. Good enough for spamsickle, anyway.
Before I save it and close it, there's one more thing I want to do. I mentioned earlier that there may be discrepancies between the left pages and the right pages, and one of those discrepancies may be in the size of the images, due to camera placement, zoom, whatever. I'd like to make the images the same in the final product, and I do that here by modifying image size.
I specify the width, and let the length stay proportional. I'll specify the same width on the left side, so at least my output images will have the same width. The length may vary a bit, but, well, you know...
And that's the meat of it. Now I just save the file...
... to a different directory (we got it from RRAW, and we'll save it in R) ...
--- with the quality I want.
When I close the file, this is how my completed action looks:
I click on the little square beside the red "Recording" indicator to stop recording, and my new action is ready to use. To use it, I choose "Automatic ... Batch" from the "File" menu.
That brings up the "Batch" dialogue, with my new action ("Right") already selected. I want to apply this action to all the files in my RRAW directory, so I choose Source as "Folder" and click "Choose" to specify which one it is. I'll be saving the images to a new folder ("R"), so I also specify Destination as "Folder" and choose that one too. All that's left to do now is to click "Okay" and go get a cup of coffee.
It runs fairly fast (on my not-so-speedy laptop, it takes just over 15 minutes to do 175 pages), and if your images are consistent, the output will be pretty much what you want. If they're not -- well, that's a hardware problem, isn't it? Get your scanner straight...
I create a separate "Left" action, and run that too, so I have anti-aliased de-keystoned formatted-just-like-the-originals images in two separate directories. At this point, you can go different ways -- convert them to PDFs, run OCR software, process them some more with an eye to making DJVu files or some other format. For me, I just run a script to rename them and faro-shuffle them into my "Both" directory, and I'm done. I'm perfectly happy reading my new book with IRFanView or some other image viewing program, and my design objectives have already been met.
There are some things you can do if your images aren't quite aligned and you can't (or don't want to) reshoot them -- the "Crop" step can be made interactive for every image by clicking the "modal" box next to that step in the script, or you can process them in smaller batches -- but this little tutorial is already too long, and who knows if anyone will even be interested.
I will say, setting up the action and running it takes no time at all, despite the fact that reading about it may have caused you to nod off. If you have Photoshop CS2 or later, and have any interest at all in quick-and-dirty get-it-done post-processing, you owe it to yourself to at least give it a try.
Photoshop solution to keystoning, etc.
Moderator: peterZ
Re: Photoshop solution to keystoning, etc.
Interesting, I didn't know you could perspective skew while cropping.
For perspective transformations without cropping, I like using Martin Vicanek's free Perspective Transformations plug-in.
For perspective transformations without cropping, I like using Martin Vicanek's free Perspective Transformations plug-in.
The opinions expressed in this post are my own and do not necessarily represent those of the Canadian Museum for Human Rights.
-
- Posts: 496
- Joined: 04 Mar 2014, 00:53
Re: Photoshop solution to keystoning, etc.
Excellent work here. I'm assuming the same features are onboard the Mac OS X version. What happens with photos and images that have no borders next to the page edge? Or is this workflow best for text with white margins?
-
- Posts: 596
- Joined: 06 Jun 2009, 23:57
Re: Photoshop solution to keystoning, etc.
The content of the page shouldn't really matter for this transformation. As long as you can identify the four corners of the page, it should work. Verifying how well it's worked may be easier when there are clear horizontal and vertical lines on the page, but for me, if there is nothing on the page which would cause me to suspect keystoning in the first place, I'm not going to obsess about how well I've "fixed" it.
Also, I was wrong about when this feature was introduced. Photoshop CS2 introduced a "vanishing point" tool, which can be used for more sophisticated perspective effects. The perspective crop tool I used here has been available since Photoshop 6.
Also, I was wrong about when this feature was introduced. Photoshop CS2 introduced a "vanishing point" tool, which can be used for more sophisticated perspective effects. The perspective crop tool I used here has been available since Photoshop 6.
-
- Posts: 496
- Joined: 04 Mar 2014, 00:53
Re: Photoshop solution to keystoning, etc.
Very great software utilization headway and the workflow examples above are fantastic. I'm spending the week to learn this flow. --Regards
Forward looking: what are your thoughts with this process and implementing it into a single camera rig that captures images directly overhead on an open facing book with a wide angle platen? The largest hurdle here is keystone-correction, so I think Photoshop could perform and crop...maybe even page split under the same batch process?
Forward looking: what are your thoughts with this process and implementing it into a single camera rig that captures images directly overhead on an open facing book with a wide angle platen? The largest hurdle here is keystone-correction, so I think Photoshop could perform and crop...maybe even page split under the same batch process?
-
- Posts: 596
- Joined: 06 Jun 2009, 23:57
Re: Photoshop solution to keystoning, etc.
I have a couple of reservations about that design, which I'll save for the Hardware forum should you decide to start a thread about it there.
From the software side, I don't think Photoshop would have a problem creating de-keystoned left and right page images from a single overhead camera shot. The one reservation I'd mention here is that "wide-angle platen" part. Flatbed scanners shooting two pages at once are wide angle -- 180 degrees wide -- and while they don't have a problem with keystoning per se, they do have a problem with warping where the pages curve into the spine. Photoshop has warping tools, and it could probably be made to flatten that inner curl, but it would be a lot more work than this simple perspective transform. I'm lazy. I'd rather avoid the need to de-warp by keeping my pages flat when I shoot, and the 90-degree platen does a pretty good job of that.
If I have time, I'll shoot a "right-angle platen" overhead image later this week and see how well Photoshop handles the keystoning.
From the software side, I don't think Photoshop would have a problem creating de-keystoned left and right page images from a single overhead camera shot. The one reservation I'd mention here is that "wide-angle platen" part. Flatbed scanners shooting two pages at once are wide angle -- 180 degrees wide -- and while they don't have a problem with keystoning per se, they do have a problem with warping where the pages curve into the spine. Photoshop has warping tools, and it could probably be made to flatten that inner curl, but it would be a lot more work than this simple perspective transform. I'm lazy. I'd rather avoid the need to de-warp by keeping my pages flat when I shoot, and the 90-degree platen does a pretty good job of that.
If I have time, I'll shoot a "right-angle platen" overhead image later this week and see how well Photoshop handles the keystoning.
Re: FREE MAC solution to keystoning, etc.
For us Mac users who also don't have the expensive PhotoShop, I just discovered a good way to deal with Keystone effect - and it won't cost anything (or very little). The Shareware GraphicConverter 7 has some new features, including de-skewing. GraphicConverter is Mac OS X software, free download from
http://www.lemkesoft.com/
Although you can using GC forever without paying, Paying for the software unlocks some additional features, notably not having to suffer through the opening nag dialog, and Automated Batch Processing, which is well worth the $39.95.
After Pulling the "Effect" menu to "Unskew (Set Proportions)" You set the 4 lines to the corners, or your crop area.
Click "Apply" button at top right.
That brings up the "Unskew" dialog box, which I left at "Auto-Fit". Checking the box to "Try to unskew complete image" will NOT crop, leaving it unchecked will crop at the red lines. OK.
GC also has a nice "white point" tool in the toolbar. Click it once, then click what is supposed to be white space.
hth
Dave
http://www.lemkesoft.com/
Although you can using GC forever without paying, Paying for the software unlocks some additional features, notably not having to suffer through the opening nag dialog, and Automated Batch Processing, which is well worth the $39.95.
After Pulling the "Effect" menu to "Unskew (Set Proportions)" You set the 4 lines to the corners, or your crop area.
Click "Apply" button at top right.
That brings up the "Unskew" dialog box, which I left at "Auto-Fit". Checking the box to "Try to unskew complete image" will NOT crop, leaving it unchecked will crop at the red lines. OK.
GC also has a nice "white point" tool in the toolbar. Click it once, then click what is supposed to be white space.
hth
Dave
Re: Photoshop solution to keystoning, etc.
Hi all,
I'm currently finalizing my workflow (I'll post about it later and, by the way, many thanks to all, I saved a lot of time with this forum) and I'd like to inform that there is another software to deal with keystoning. It's name is DxO. It's well known by professional photographers (at least here, in France). It does a pretty decent job in this matter and its price is lower than Photoshop/Lightroom.
Maybe it can interest someone.
For more information, please see: http://www.dxo.com/intl/photo for general informations and http://www.dxo.com/intl/photo/dxo_optic ... orrections for informations about optical correction.
I'm currently finalizing my workflow (I'll post about it later and, by the way, many thanks to all, I saved a lot of time with this forum) and I'd like to inform that there is another software to deal with keystoning. It's name is DxO. It's well known by professional photographers (at least here, in France). It does a pretty decent job in this matter and its price is lower than Photoshop/Lightroom.
Maybe it can interest someone.
For more information, please see: http://www.dxo.com/intl/photo for general informations and http://www.dxo.com/intl/photo/dxo_optic ... orrections for informations about optical correction.