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