Reform

Abstract
Author V. C. Mohan
Version Dec 27, 2012
Category Transformation
Discussion Doom9 Forum

 Description

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 a quadrilateral.

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. For reading coordinates correctly the 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

 Syntax and Parameters

Deskew (clip, clip, string "resize", float "ltopx", float "ltopy", float "lbotx", float "lboty", float "rtopx", float "rtopy", float "rbotx", float "rboty", float "leftx", float "rightx", float "ytop", float "ybot", float "eltopx", float "eltopy", float "elbotx", float "elboty", float "ertopx", float "ertopy", float "erbotx", float "erboty", float "eleftx", float "erightx", float "eytop", float "eybot")
Skew (clip, clip, string "resize", float "ltopx", float "ltopy", float "lbotx", float "lboty", float "rtopx", float "rtopy", float "rbotx", float "rboty", float "leftx", float "rightx", float "ytop", float "ybot", float "eltopx", float "eltopy", float "elbotx", float "elboty", float "ertopx", float "ertopy", float "erbotx", float "erboty", float "eleftx", float "erightx", float "eytop", float "eybot")

clip   =
Input clip to be skewed or deskewed.

clip   =
Background clip.

string  resize = "lanczos"
Resize interpolation to use: `"lanczos" | "line" | "point"`

float  ltopx = 0
float  ltopy = 0
Quadrilateral left top x and y coordinates.

float  lbotx = 0
float  lboty = height-1
Quadrilateral left bottom x and y coordinates.

float  rtopx = width-1
float  rtopy = 0
Quadrilateral right top x and y coordinates.

float  rbotx = width-1
float  rboty = height-1
Quadrilateral right bottom x and y coordinates.

float  leftx = 0
float  rightx = width-1
Rectangle coordinates: leftx and rightx.

float  ytop = 0
float  ybot = height-1
Rectangle coordinates: top y and bottom y.

float  eltopx = ltopx
float  eltopy = ltopy
End frame, Quadrilateral left top x and y coordinates.

float  elbotx = lbotx
float  elboty = lboty
End frame, Quadrilateral left bottom x and y coordinates.

float  ertopx = rtopx
float  ertopy = rtopy
End frame, Quadrilateral right top x and y coordinates.

float  erbotx = rbotx
float  erboty = rboty
End frame, Quadrilateral right bottom x and y coordinates.

float  eleftx = leftx
float  erightx = rightx
End frame Rectanlge coordinates: left x and right x.

float  eytop = ytop
float  eybot = ybot
End frame Rectanlge coordinates: top y and bottom y.

 Examples

Script example:

``` ColorBars().ConvertToRGB32()
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")
```

Back to External Filters