1"c0rners" is an attempt to introduce a new, more intuitive way (at least in some 2cases) of specifying geometrical image transforms. 3"c0rners" is a Frei0r plugin. 4 5 6Written by Marko Cebokli, apr 2010 and released under GNU GPL 7 8 9RELEASE NOTES 10 11apr 2010 12Version 0.1 "pre-alpha" (throw it out and see what happens... :-) 13 14 15TODO: 16 17- alpha feathering of caustics 18- use gavl for remapping 19- make piece between Little and Big Indians 20 21 22SOME NOTES ABOUT THE PLUGIN 23 24"c0rners" is a rather universal "geometry engine". It can do even more things 25than the usual affine matrix transform. 26 27It can do: 28 29-shifts 30-flips 31-arbitrary scalings and anamorphs (anisotropic scaling) 32-arbitrary angle rotations around arbitrary points 33-perspective correction in any direction 34-shears, distorts...etc... 35 36...and arbitrary combinations of these, in a single, time and quality preserving 37step! 38 39 40Its advantages are best explained in an example: 41 42Say, you have video1 which is a wideangle shot of a room with a picture frame on 43a side wall. You want video2 to display as if it was played inside that frame. 44 45Now, with "classic" tools, you would need to do: 461 - scale down 472 - sideways perspective distort 483 - shift to the right place 494 - and maybe some rotation 50 51Tweaking all of the parameters of these transforms, to get the desired size, 52shape and position of video2, would be quite a chore. 53 54With c0rners, you simply pull the corners of video2 to where you want them, and 55it will do all of the above in a single step! 56 57My goal while programming it, was to make it survive ANY crazy combination of 58corner positions the user might throw at it. 59I'm not sure if I achieved that, but remember that if all corners are outside of 60the frame to one side, or if you specify a zero area degenerate quadrangle, 61there will be no output! This is not a bug - it is as should be. 62If you happen onto a set of parameters that will crash it, please document 63carefully the parameter values and video format, and let me know about it. 64 65 66 67PARAMETERS 68 691. Corner positions 70 71For now, the user interface is not as nice as I would like... While the Frei0r 72specification includes a "position" type parameter, it seems that host apps like 73Kdenlive and Openmovieeditor currently do not pass such parameters to Frei0r 74plugins. 75Therefore, I just used two sliders (x,y) for each of the four corners. 76This is rather clumsy, so as soon as I will figure out a better way, I will 77change this. 78 79Corner 1 is the top left of the original picture, and the others follow 80clockwise. 81 82Since it should be possible to pull the corners outside of the picture area, the 83range of the parameters goes one picture width to the left and right, and one 84picture height above and under the original picture. 85Therefore, in the unscaled Frei0r 0...1 parameter range, the top left corner is 86x=0.333... y=0.333..., the top right x=0.666... y=0.333... and so on. 87The supplied Kdenlive effect description XML file should change this range to 880...3000, so that the original image lies between 1000 and 2000, with the upper 89left corner x=1000, y=1000, the upper right corner x=2000, y=1000 and so on. It 90should also set the defaults so that the undistorted input picture is displayed. 91If you have no image, check that the corners specify a nonzero area at least 92partly overlaping the output window. 93 942. Stretch, x and y 95 96These allow additional exaggeration of the perspective, when simulating a tilted 97plane. The default (undistorted) position is in the middle. I have included a 98boolean checkbox parameter to disable this (default). These can also be used 99alone (without moving the corners), to do funny things, like stretch people's 100legs. 101 1023. Interpolation 103 104This allows one to choose a tradeoff between speed and quality. Low values = 105high speed with low quality. 106Default is bilinear, which is reasonably fast and should give enough quality in 107most cases. 108 1094. Transparent background 110 111This fills the area outside of the transformed image with a "transparent" alpha 112value. 113This can be used to make a composite image - for example, in Kdenlive, use the 114"Composite" transition with this. 115Making the corner positions keyframable would allow one to create those "fly 116away" transitions that were once so popular. 117 1185. Alpha Feather 119 120This can be used to make the transition between transparent and opaque gradual. 121It should specify the width of the transition in pixels, 0 to 100. 122For now it does not feather the "caustics" (those curved lines in the concave 123and crossed settings, which are not edges of the input picture). 124