I've only tried this on a single image so far, but I got excited, so I thought I would share.
To make things easy on Scan Tailor, I figured that I could correct for keystoning by throwing a checkerboard onto the platen every N pages, and once all the scanning was done, have a preprocessor program run through the images, find the checkerboard calibration images, and dekeystone all following page images from there (until the next checkerboard image was encountered). If you have to change the location, orientation, or zoom of the camera, you would have to throw the checkerboard back up to add a new calibration image.
The goal here is to correct for distortion caused by camera location and orientation with respect to the platen. NOT with respect to the book, which is what Scan Tailor is for.
So I wrote a program (in C, and I cried while doing it) which takes one checkerboard image, computes a dekeystoning correction, and applies it to a second image. I used OpenCV, which is a free image processing library that has checkerboard detection routines.
Here are the results. Discussion follows after each image.
Here are small versions of the checkerboard image (left) and the same image after automatic correction (right). Since the checkerboard is supposed to be square, it is easy to take the four detected corners, figure out where they were supposed to be if the checkerboard image were truly square, and compute a transform which corrects the image.
Here is what was hiding behind the checkerboard. I added a thin rectangle around the text block so you can see that there is keystoning: at the bottom, the text breaks out of the box, even though the top and bottom margins appear pretty straight.
NOTE: Click on the image to see in full. For some reason, the scrollbars aren't appearing in my browser so I can't see the entire image. If that happens to you, just click on the image to see the whole thing.
I applied the checkerboard correction parameters that I found in the checkerboard calibration image to the page image. (The exposure looks different because I manually corrected it. Not well enough, obviously) At first I was puzzled because the image seemed rotated, but I realized that perhaps the book was rotated slightly with respect to the platen. So I unrotated the image (in Photoshop) and applied a thin rectangle. The results are much better. I believe that any distortion remaining is due to warping.
So in theory, ST should have an easier time with this image in terms of automatically rotating it, finding margins, and dewarping.
The next step is to alter the program to run through a list of images, and then release the program. Sadly, the program is C and relies on external libraries (namely, OpenCV), which means this isn't going to be as polished as Scan Tailor :/
The two-image program source code is attached, if anyone is interested. It requires OpenCV 2.2.
