[OSM-dev] Geometry help

Richard Fairhurst richard at systemeD.net
Wed Oct 17 10:07:56 BST 2007


Hi all,

I'm doing a bit of rectification work on the New Popular Edition  
scans. The aim is to make them suitable for use as a Potlatch  
background without the user having to compensate much for warps/folds  
in the paper.

If I have a quadrilateral with corners

    x1,y1     x2,y2

    x3,y3     x4,y4

(not a perfect square, but x1 and x2<x3 and x4, y1 and y2<y3 and y4, etc.)

then what maths do I need to apply to warp it into a square?

I'm using the Perl Imager module (so much nicer than ImageMagick)
    http://search.cpan.org/~tonyc/Imager-0.60/lib/Imager/Engines.pod

which has an programmable pixel remapping routine that works like this:
    $new_img=$img->transform(xexpr=>'x+0.1*y+5*sin(y/10.0+1.57)',
                             yexpr=>'y+10*sin((x+y-0.785)/10)');

Any help greatly appreciated.

cheers
Richard





More information about the dev mailing list