Homograhy Python code to calc Homograpy matrix from each 4 points of source and destination. # 4つの点からホモグラフィ行列(平面射影変換行列)を求める http://www.gistlog.org/gist/887734 See the link, great example of ImageMagick , how 4 point perspective distortion works. http://www.imagemagick.org/Usage/distorts/#perspective Any destination points are calculated by next. x' = Hx (x : source, x' : dest, H : homography) x' x s * ( y' ) = H ( y ) 1 1