"T F" on wrote... | The documents were not put squarely on the scanner. they need to be | rotated by a few degrees. the proposed bash-imagemagick script | calculates that angle on a image by image basis so that the images can | be batch processed. | Applogies, you said scanner, I though digital photo. See the way I scan pages is set up my digital camera on a tripod and take a picture of the page :-) Works extremely well.
This is actually a common question but with no simple solution as yet. First I am sad to say that IM is not quite ready for this type of work. :-( The closest technique IM has current is a Linear Affine Transformation.. See the incomplete IM Examples... http://www.cit.gu.edu.au/~anthony/graphics/imagick6/distorts/#affine To make using affines easier easy I have a couple of scripts submitted by Gabe Schaffer and Rick Mabry on the IM examples web site that takes 3 starting coordinates and 3 ending coordinates and outputs the affine matrix needed... Go to Support Scripts.. http://www.cit.gu.edu.au/~anthony/graphics/imagick6/scripts/ and look at the scripts "affine_mapping.pl" and "affine_mapping.pl.v2" With this script you should be able to specify three image corners, and the position you would like those corners to be then generate a affine mapping to transform your image. Now for the bad news.... * Affine Transforms, while a lot better than it was is still incomplete... Scales, Rotations and Shears all work correctly but translations are still incorrect See IM Examples, future development notes http://www.cit.gu.edu.au/~anthony/graphics/imagick6/bugs/future/ This is the reason the IM examples is itself incomplete!!! * Affine matrix are a pure linear transformation. It will not handle a perspective or trapezoidal transformation. That is if the distance of the two oppisite edges of the image are NOT the same, (should not happen with a scanner, but would with a camera), then an affine matrix will not position the fourth corner correctly. The only current method of fixing this with IM is to use a distortion map, to distort the whole image appropriateally. However examples for distortion maps are still primate and have not reached a point where it can be used for such work. To see what IM examples have achieved with this method see... http://www.cit.gu.edu.au/~anthony/graphics/imagick6/distorts/#distort_maps The only non-IM solution suggested in the past has been to use a 'triangular mesh transformation' method, as implemented by the "xmorph" program. I am sorry that I can not give you a final solution. If anyone else has a suggestion, or even a non-IM solution, then please contribute. Anyone else know of other non-IM fixes for this problem? Further development, experiments, examples and suggestions are always welcome by the IM user community. What can you do with IM? Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- "There is hopeful symbolism in the fact that flags don't wave in a vacuum." -- Arthur C. Clarke ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/ _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
