This plugin is extensively recoded in Mar 2009 for speeding up. Also in place of color a background clip is added
I had taken a video by standing to one side of an flat object (painting) and found that the image is skewed. I authored this plugin function to correct this phenomenon. The corner coordinates of the skewed image and the correct rectangular coordinates it need to be transformed are to be input. Functions to skew a rectangular image are also included. Depending on tradeoff between accuracy and time to process bicubic or bilinear or nearest point interpolation can be selected.
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.
| 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 | Integer | Within frame and more than 1 | 2 |
| Q left top y coordinate | ltopy | Integer | Within frame and more than 1 | 2 |
| Q left bottom x coordinate | lbotx | Integer | Within frame and more than 1 | 2 |
| Q left bot y coordinate | lboty | Integer | Within frame and less than frame height-1 | frame height-2 |
| Q right top x coordinate | rtopx | Integer | Within frame and more than 1 | 2 |
| Q right top y coordinate | rtopy | Integer | Within frame and more than 1 | 2 |
| Q right bottom x coordinate | rbotx | Integer | Within frame and more than 1 | 2 |
| Q right bot y coordinate | rboty | Integer | Within frame and less than frame height-1 | frame height-2 |
| R left x coordinate | leftx | Integer | Within frame and more than 1 | 2 |
| R right x coordinate | rightx | Integer | Within frame and not more than width-1 | width-2 |
| R top y coordinate | ytop | Integer | Within frame and more than 1 | 2 |
| R bottom y coordinate | ybot | Integer | Within frame and less than frame height-1 | frame height-2 |
| End frame Q left top x coordinate | eltopx | Integer | Within frame and more than 1 | ltopx |
| End frame Q left top y coordinate | eltopy | Integer | Within frame and more than 1 | ltopy |
| End frame Q left bottom x coordinate | elbotx | Integer | Within frame and more than 1 | lbotx |
| End frame Q left bot y coordinate | elboty | Integer | Within frame and less than frame height-1 | lboty |
| End frame Q right top x coordinate | ertopx | Integer | Within frame and more than 1 | rtopx |
| End frame Q right top y coordinate | ertopy | Integer | Within frame and more than 1 | rtopy |
| End frame Q right bottom x coordinate | erbotx | Integer | Within frame and more than 1 | rbotx |
| End frame Q right bot y coordinate | erboty | Integer | Within frame and less than frame height-1 | rboty |
| End frame R left x coordinate | eleftx | Integer | Within frame and more than 1 | leftx |
| End frame R right x coordinate | erightx | Integer | Within frame and not more than width-1 | rightx |
| End frame R top y coordinate | eytop | Integer | Within frame and more than 1 | ytop |
| End frame R bottom y coordinate | eybot | Integer | Within frame and less than frame height-1 | ybot |
| resize interpolation to use | resize | string | "cubic" "line" "point" | "cubic" |
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")
| Test input | |
| Deskewed | |
| Reskewed | |
| Real image | ![]() |
| deskewed | |
| reskewed |
| To my index page | down load plugin | To Avisynth |