Is there a module to do it? Not that I know of.
Looking for tips on how to do it?
Once you've loaded the image into memory (see PerlMagick or GD or some other image-buffer module), it's time to start doing some math. The PDL may help here, but I haven't used it much yet. These are only general advice; I've done exactly this sort of image processing in a past life, but not in Perl and not in years.
- Don't use resampling methods which will blur your data. If you have to skew, move each row or column by full pixel distances. If you have to stretch, favor stretching bigger, and only by full pixel distances (i.e., if you had 50 black then 50 white pixels, if you need to stretch out three pixels, it should end up 52 black then 51 white, and never introduce or "invent" new shades of gray).
- Decide on a tolerance, where pixels dimmer than X are considered "black" for the purposes of image alignment.
- One approach to vertical alignment would be to find the centroid of the top row of cells, and the left row of cells, then skew the image in each direction to square them up. There are a couple approaches to finding the centroids, depending on just how far out of whack your samples might be originally.
- If your samples aren't squared up (the bottom row might be significantly longer or shorter than the top row), then you'll have to correct for this as well. Skew the image for the first two axes, then stretch rows to form a constant height, then stretch columns to form a constant width.
- Lastly, once the image is rectangular, it should be easy to scan and trim any excess pixels around the border.
--
[ e d @ h a l l e y . c c ]