>> T F wrote:
>> > i'd like to scan several hundred of my 4x6 prints (photographs)
>> >
>> > in my trials, the orientations of the tiff files end up being slightly
>> > off, randomly, by several degrees.
>> >
>> > some need to be rotate by +2.3 degrees, others by +3.7, others by -1.2,
>> > etc ....

The angle varies from one image (scanned) to the next image. The variation is
due to minor misalignments when the original is placed on the platten (by an
automatic document feeder).

I was hoping to use someone else's script or plugin that calculates the
angle on an image by image basis, and then does the rotation and crop.

If I need to code it myself, I would start by trying something like the
following, probably with imagemagick.

1) for speed, reduce image to about 100px per edge
2) edge detect radius=0, which tends to draw a box around the image
3) quantize to 2 colors
4) save as ascii matrix of 0s and 1s
5) work with rows/columns as arrays
6) determine indicies of first 1s
7) calculate slope of least sq line
8) repeat for bottom, top, left, right sides
9) toss out anomolous slopes, avg the rest
Gimp-user mailing list

Reply via email to