We work with scanned books with this output which we will consider the original.
This image comes from the scanner this way. And we need to work in high resolutions so this image will be at 300 dpi with Width 33,4 inches and Height 21 inches.
Now I need to straighten or deskew, trim, split the two pages, deskew and trim again.
So I use a bunch of filters to turn the image as easier as possible to compute not only the deskew but the trim also. But i need to do this on the side and apply the result to the original.
If I apply deskew to this image I get e pretty good result.
Also, since we are working with big images, if I would make a clone or copy, downsize it, take the color off, I could fasten the whole operation. (last project was with 20 000 images like this one). apply the filters deskew, get the angle, use it on the original. Later on get the best trim possible, apply the results on the original. (the trim should not cut any part of the original)
Final result would be this.
So using a copy of the original, apply the results to the original. If I can understand this, I can create and evolve my programming.
All of this I already do on photoshop through batch.