Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
24th March 2003, 08:44 | #1 | Link |
C64
Join Date: Apr 2002
Location: Austria
Posts: 830
|
Zoom plugin (Pan/Zoom/Rotate)
As there is often the need for moving a video around I made a plugin for this. (it should help shorten some of Wilbert's monster-Animate-scripts ).
It has the following syntax: Zoom(string "srcx", string "srcy", string "dstx", string "dsty", string "factorX", string "factorY", string "angle") As you see there are no number arguments. You can insert every script function AviSynth knows of which returns a number. srcx/srcy are the "center" coordinates in the original frame, dstx/dsty are the center coordinates in the moved frame, factorX, factorY are the magnification factors, angle is the rotation angle in radian. Sounds complicated? Not really, try this: version().converttorgb32().zoom(dstx="n", angle="n/10") Here you see that the variable "n" can be used to reference to the current frame number (and this is of course the most important thingie). Or try: version().converttorgb32() zoom(factorx="n<41 ? pow((n+1)/41,0.5) : 1", factory="n<41 ? pow((n+1)/41,0.5) : 1", dstx="n<41 ? width/2 : width/2+5*(n-41)", angle="n<41 ? 3.1415*n/10 : 0") And the new image gets a defined alpha layer (black=transparent, else opaque), so you can layer the result on top of another video. This was the good news. The bad news: -only RGB32 (I want to use alpha) -quite slow (but it's only a trick filter for not so many frames) -the resizer is poor, and I think I've got some rounding errors still present. Get is here: http://members.aon.at/archi/warpenterprises.html |
25th March 2003, 08:31 | #4 | Link |
C64
Join Date: Apr 2002
Location: Austria
Posts: 830
|
Would have sitten much longer at my PC if I had not used the AviSynth parser
What do you mean with "cannot trust" ? The bug that "-" and "/" was treated in the wrong order ist gone now. ---------- Uploaded new version. Changes: - no rounding errors anymore (most calculations in float) - fixed small bug with default values - added two parameters: width, height now you can specify the dimensions of the final image (e.g. to "make room" for the rotation) Improving the resizer (in downscale mode) seems not feasible to me, so if there are no more bugs found it seems finished. Of course it can be used e.g. as plain rotate: e.g. Zoom(angle=...) will do nothing but rotate your image. Get is here: http://members.aon.at/archi/warpenterprises.html PS: 2.5 version coming soon Last edited by WarpEnterprises; 25th March 2003 at 08:41. |
4th April 2003, 10:19 | #8 | Link |
C64
Join Date: Apr 2002
Location: Austria
Posts: 830
|
Another addition made to ZOOM.DLL (only 2.0x version so far)
Zoom(show=true): prints the calculated values on the screen CHR.DLL (2.0 and 2.5) now has a function Spline (X, x1,y1, x2,y2, ...) which interpolates the given X with a bicubic spline and gives back the corresponding Y (useful mainly together with Zoom) E.g. try: version().converttorgb32() zoom(factor="Spline(n, 0,0, 10,1, 30,0.5,31,0.5, 100,0.5)", \ dstx="Spline(n, 0,200, 30,200, 100,400)", \ show=true) So you can give a simple "path" to the parameters instead of fiddling with sin, cos, exp,... |
15th April 2003, 19:06 | #9 | Link | |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
Quote:
|
|
17th April 2003, 15:07 | #10 | Link |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
WE, consider this a bump. Perhaps my question was just dumb but I am trying to trace this access violation with the latest build of avisynth and the zoom function and spline function. Can you check it or just give me a standalone example script that will run on your machine so that I may also check on mine to see if it is machine specific or a general anomaly?
|
17th April 2003, 21:40 | #11 | Link |
C64
Join Date: Apr 2002
Location: Austria
Posts: 830
|
I was not shure if you really tested it against my functions and not got a "false" alarm caused by general convert... problems.
(I'm still mentally not @ 2.5) I will see if I can reproduce it. [EDIT]: No, can't reproduce it. - zoom_25_dll_20030402.zip - AviSynth 2.51 15.4.2003 Spline is built-in since this release and works, too. Which OS? Last edited by WarpEnterprises; 17th April 2003 at 22:14. |
10th October 2003, 12:10 | #12 | Link |
Registered User
Join Date: Feb 2002
Posts: 1,195
|
Hi,
just a few comments/questions 1) can we expect an yuy2 or yv12 version of this filter ? 2) apparently there is an acces violation if u use the zoom after the resize. (i use the version 20030518 dll). ---------------- this cause access memory violation video=video.Crop(2,96,0,-40) video=video.BicubicResize(640,372,0,0.5) video=video.Zoom(factor="1") this work fine (but it's hard to adjust zoom ) video=video.Crop(2,96,0,-40) video=video.Zoom(factor="1") video=video.BicubicResize(640,372,0,0.5) ---------------- 3) another suggestion is to add msg restriction on parameters , for exemple if i set factor=0 i will obtain a black screen , perhaps sould u add min and max value in the readme file , and add a avisynth msg if the params are not corrects keep up the good work. Bye.
__________________
AutoDub v1.8 : Divx3/4/5 & Xvid Video codec and .OGG/.MP3/.AC3/.WMA audio codec. AutoRV10 v1.0 : Use RealVideo 10 Codec and support 2 Audio Streams and Subtitles. |
11th October 2003, 21:47 | #13 | Link |
C64
Join Date: Apr 2002
Location: Austria
Posts: 830
|
1) No, sorry, it would be too hard for me.
2) This is bad, I will take a look at this. [edit] what resolution has "video"? I can't reproduce an error so far. Send me a piece of your video (3 frames should be enough) and the script, if you don't mind. 3) As the parameters are evaluated for each frame, an error would occur during runtime and would stop the scipt from executing. And if I didn't overlooked anything, all values should be "in principle" possible, e.g. factor=0 results in a reduction to a point. 4) I found that I handle alpha not very well, I will correct this. (setting alpha to transparent where the resulting image has no source counterpart) thanks for your suggestions! Last edited by WarpEnterprises; 11th October 2003 at 22:55. |
15th January 2004, 23:55 | #14 | Link |
Still Kick'n
Join Date: Oct 2001
Posts: 677
|
Thank you for this filter. I was messing around with Crop and some other filters to try and keep aspect and just zoom in but got all messed up. I like to keep it simple and that's what your filter lets me do By doing for example Zoom(factor="1.5") zooms in just nicely. I just have two questions I AM getting the same aspect ratio, correct? and I notice it blurs when I zoom, is that caused by the filter or just the natural outcome of resizing bigger?
Thank again |
16th January 2004, 08:25 | #15 | Link |
C64
Join Date: Apr 2002
Location: Austria
Posts: 830
|
- it assumes 1:1 aspect (the input must be square aspect)
- the resizer is not very good, it is like linear upsize and nearest neighbour downsize. I don't know how to make this better as I use one simple formula for all operations. It would require much more logic and/or mathematic. |
19th January 2004, 22:05 | #19 | Link |
C64
Join Date: Apr 2002
Location: Austria
Posts: 830
|
Assume a 16:9 video, res. e.g. 704x576.
Resizing to 4/3*576 = 768 gives 1:1 AR. Now do the Zoom'ing and then resize back to 704x576: lanczosresize(width,height*4/3) zoom(angle="90",factor="1.3") lanczosresize(width,height*3/4) The 1.3-factor is to avoid the black borders in this example. |
30th July 2005, 00:57 | #20 | Link |
Registered User
Join Date: Oct 2004
Location: 'neutral' zone
Posts: 110
|
I need some assistance with zoom().
Belong my first impression and other threads it's quite tricky to handle.
I could imagine a zoom movement would freshen up movementless sequences. That rotation feature of zoom() is interesting too although i already fail with trivial zooming to a special position. The examples in the readme zoom.txt are amazing to watch but didn't enlighten me enough. Even i understand it zoom() complete wrong or i must look for a brain-update... An example. How to zoom on Mrs. Bride's eyes in the following frame (=>sequence) ? => I have prepared the values. However the script below doesn't create the intended effect. I really would be glad if somebody could tell me the correct syntax or just give me some hints. Code:
LoadPlugin("D:\Programs\Video\AviSynth\Plugins\zoom.dll") # # Zoom(string "srcx", string "srcy", string "dstx", string "dsty", # \ string "factorX", string "factorY", string "factor", # \ string "angle", int "height", int "width", bool "show" ) # # www.kill-bill.com/wallpapers/kill_bill_a_12.jpg imagereader("kill_bill_a_12.jpg",0,500,fps=25) converttorgb32() # src size : 1280 x 960 # src center : srcx="640", srcy="480" # dst size : 320 x 240 # dst coord left/top : 574/204 # dst coord right/down: 894/444 # center dst : dstx="734", dsty="324" ReduceBy2() # now...: # src size : 640 x 480 # src center : srcx="320", srcy="240" # dst size : 160 x 120 # dst coord left/top : 287/102 # dst coord right/down: 447/222 # center dst : dstx="367", dsty="162" zoom(srcx="320", srcy="240", dstx="367", dsty="162", angle="0") # width=160, height=120 |
Thread Tools | Search this Thread |
Display Modes | |
|
|