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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th March 2003, 07:44   #1  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
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
WarpEnterprises is offline   Reply With Quote
Old 24th March 2003, 09:26   #2  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
Very cool! I will try it when I have some time ...
Wilbert is offline   Reply With Quote
Old 24th March 2003, 16:28   #3  |  Link
Bidoche
Avisynth 3.0 Developer
 
Join Date: Jan 2002
Location: France
Posts: 639
sounds great, especially the string configurable args.
(I hope your parser can be trusted, unlike avisynth's one)
Bidoche is offline   Reply With Quote
Old 25th March 2003, 07:31   #4  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
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 07:41.
WarpEnterprises is offline   Reply With Quote
Old 25th March 2003, 08:21   #5  |  Link
kilg0r3
! - User - !
 
kilg0r3's Avatar
 
Join Date: Nov 2001
Posts: 1,081
@Warp...
Thank You very much for this plugin! It is basically just what I was waiting for.
__________________
Keep your tone warm and your sigs decent!
kilg0r3 is offline   Reply With Quote
Old 25th March 2003, 10:24   #6  |  Link
Bidoche
Avisynth 3.0 Developer
 
Join Date: Jan 2002
Location: France
Posts: 639
@Warp

I guess that's just me being paranoid then
Bidoche is offline   Reply With Quote
Old 3rd April 2003, 13:06   #7  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
AviSynth 2.5 version uploaded.
Look at the "www" button under the message.
WarpEnterprises is offline   Reply With Quote
Old 4th April 2003, 10:19   #8  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
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,...
WarpEnterprises is offline   Reply With Quote
Old 15th April 2003, 19:06   #9  |  Link
DDogg
Retired, but still around
 
DDogg's Avatar
 
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
Quote:
Sounds complicated?
Not really, try this:
version().converttorgb32().zoom(dstx="n", angle="n/10")
Since I see version as source? I am assuming the above is a standalone example of a simple avs script that should yield a video result. Using the April 15 2.51 csv build I get: "Avisynth: caught an access violation at 0x77e7650d, attempting to read from 0x00a7e578" when I attemp to run it, both with and without a loadplugin ("zoom.dll")line
DDogg is offline   Reply With Quote
Old 17th April 2003, 15:07   #10  |  Link
DDogg
Retired, but still around
 
DDogg's Avatar
 
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?
DDogg is offline   Reply With Quote
Old 17th April 2003, 21:40   #11  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
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.
WarpEnterprises is offline   Reply With Quote
Old 10th October 2003, 12:10   #12  |  Link
Dark-Cracker
Registered User
 
Dark-Cracker's Avatar
 
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.

Dark-Cracker is offline   Reply With Quote
Old 11th October 2003, 21:47   #13  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
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.
WarpEnterprises is offline   Reply With Quote
Old 15th January 2004, 22:55   #14  |  Link
Holomatrix
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
Holomatrix is offline   Reply With Quote
Old 16th January 2004, 07:25   #15  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
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.
WarpEnterprises is offline   Reply With Quote
Old 16th January 2004, 12:15   #16  |  Link
Holomatrix
Still Kick'n
 
Join Date: Oct 2001
Posts: 677
Darn, I would only use it for thoes really wide screen flicks
Holomatrix is offline   Reply With Quote
Old 16th January 2004, 12:20   #17  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
you can resize it to 1:1, then Zoom, then resize it to 16:9 again.
WarpEnterprises is offline   Reply With Quote
Old 16th January 2004, 14:55   #18  |  Link
Holomatrix
Still Kick'n
 
Join Date: Oct 2001
Posts: 677
Can you give me an example of what I would plug into my script.
Thanks
Holomatrix is offline   Reply With Quote
Old 19th January 2004, 21:05   #19  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
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.
WarpEnterprises is offline   Reply With Quote
Old 30th July 2005, 00:57   #20  |  Link
AsTimeGoesBy
Registered User
 
AsTimeGoesBy's Avatar
 
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
AsTimeGoesBy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.