Author V. C. Mohan
Feb 12, 2005. Modified on 7 Sep 2006, Mar 18, 2009, July 7, 2011, Aug 12, 2011, Sep 22, 2012 26 Dec 2012

This plugin is extensively recoded in Mar 2009 for speeding up. Also in place of color a background clip is added. During Dec 2012 another revamp was done to enable accepting floating point input and almost no restrictions in the values of the cooordinates

Reform plugin does a geometric transformation and in certain cases may produce artifacts. Reformer Plugin which does Matrix operations gives better results and if possible switch to that plugin.

This plugin is meant for correcting minor distortions. If used for very large distortions most likely the linearity assumptions and interpolation quality will suffer. Artifacts may appear especially in case of deskew function.

There are 2 functions included in this plugin. These are:

Deskew : Converts a quadrilateral to a rectangle.

Skew : Converts a rectangle to aquadrilateral.

Most of the parameters can be linearly varied over the length of the effect, and so it can be used to distort or correct distorted faces or objects progressively. The parameters for both these functions are identical. RGB32, RGB24, YUY2 and YV12 formats are accepted. For reading coordinates correctly my plugin Grid can be used. Interpolation options are Lanczos 6x6, cubic 4x4, linear 2x2 and nearest point It has to be ensured that the quadrilateral is convex

Description of parameters. Q stands for Quadrilateral and R for rectangle.
Parameter Parameter name Variable type Limits of values Default value
clip to be skewed or deskewed clip none
clip to be used as background clip none
Q left top x coordinate ltopx float none 0
Q left top y coordinate ltopy float none 0
Q left bottom x coordinate lbotx float none 0
Q left bot y coordinate lboty float none frame height-1
Q right top x coordinate rtopx float none width - 1
Q right top y coordinate rtopy float none 0
Q right bottom x coordinate rbotx float none width -1
Q right bot y coordinate rboty float none frame height-1
R left x coordinate leftx float none 0
R right x coordinate rightx float none width-1
R top y coordinate ytop float none 0
R bottom y coordinate ybot float none frame height-1
End frame Q left top x coordinate eltopx float none ltopx
End frame Q left top y coordinate eltopy float none ltopy
End frame Q left bottom x coordinate elbotx float none lbotx
End frame Q left bot y coordinate elboty float none lboty
End frame Q right top x coordinate ertopx float none rtopx
End frame Q right top y coordinate ertopy float none rtopy
End frame Q right bottom x coordinate erbotx float none rbotx
End frame Q right bot y coordinate erboty float none rboty
End frame R left x coordinate eleftx float none leftx
End frame R right x coordinate erightx float none rightx
End frame R top y coordinate eytop float none ytop
End frame R bottom y coordinate eybot float none ybot
resize interpolation to use resize string "lanczos" "line" "point" "lanczos"

Script examples:-
img = avisource("..........")
bg = blankclip(img, color = ...)

deskew(img, bg,ltopx=44,ltopy=17,lbotx=34,lboty=470,rtopx=612,rtopy=70,rbotx=684,rboty=426)
deskew(img, bg,ltopx=44,ltopy=17,lbotx=34,lboty=470,color=$ff00, resize = "point")

skew(img, bg,ltopx=44,ltopy=17,lbotx=34,lboty=470,rtopx=612,rtopy=70,rbotx=684,rboty=426)
skew(img, bg,ltopx=44,ltopy=17,lbotx=34,lboty=470,color=$ff00, resize = "line")

Output examples:
Test input
Real image

To my index page down load plugin To Avisynth