Log in

View Full Version : Zooming in


HartleySan
10th August 2012, 05:40
Hello everyone. I'm pretty new to AviSynth, so I apologize if my question is really "newb-ish".

I have an AVI video source that at certain points, I want to be able to zoom in on certain parts of the screen. Ideally, I'd like to be able to animate the zoom, so that it doesn't instantly go from the standard view to the fully-zoomed view. If that's too hard or too much trouble though, I don't mind just going with an instantaneous zoom. Likewise, I'd like to be able to zoom out when I'm done.

I imagine that there is a function or set of functions in AviSynth that will allow me to specify the width and height of the zoom box, the x- and y-offsets, the zoom filter, and from what frame to what frame I want the zoom to be in effect, but I don't know the specifics.

Beyond the concept of how to achieve a zoom effect though, I have no clue how to actually do it in AviSynth. Any help or pointing in the right direction would be much appreciated. Thank you all very much.

GrofLuigi
10th August 2012, 14:14
Maybe you can find something here (http://forum.doom9.org/showthread.php?t=135776)...

GL

Guest
10th August 2012, 16:48
I have a VirtualDub Zoom filter that can do that and can (presumably) be used via LoadVirtualDubPlugin().

http://neuron2.net/zoom.html

IanB
10th August 2012, 23:52
:search: "Animate resize" in "Avisynth Usage"

This one by me, post853300, should start the ball rolling. Basically you use the input crop parameters of a resizer to choose a zoom window, then resize that window back to the original size. Put all the tricky calculations into a user function then use Animate on that function to vary the parameters with frame number.

Depending on the picture content you wish to zoom in on, you may want to use something from the NNEDI family or similar to increase the function's input resolution before you animate your zoom window.

HartleySan
11th August 2012, 00:08
Wow! Lots of great stuff to look at. Thanks you all.
After I get through it all, I will report back with the results.

Thanks again.

Didée
11th August 2012, 02:12
This one dates back to 2006, too:
function ZoomInOut( clip clp, int start, int end, int fade_in, int fade_out, int x0, int y0, int x1,int y1 )
{ ox=clp.width()
oy=clp.height()
x0=float(x0)
y0=float(y0)
x1=float(x1)
y1=float(y1)

magnify = clp.animate(start-fade_in,start,"LanczosResize",
\ ox,oy,0,0,ox,oy, ox,oy, x0,y0,ox-x0-x1,oy-y0-y1) .trim(start-fade_in,start)
reduce = clp.animate(end, end + fade_out,"LanczosResize",
\ ox,oy,x0,y0,ox-x0-x1,oy-y0-y1, ox,oy,0,0,ox,oy) .trim(end, end + fade_out)
between = clp.trim(start+1,end-1).LanczosResize(ox,oy,x0,y0,ox-x0-x1,oy-y0-y1)
return clp.trim(0,start-fade_in-1) +magnify+between +reduce+clp.trim(end+fade_out+1, 0)
}

It was meant for zooming-away of in-show TV advertisements, hence the whacky start/end logic.

start, end: first / last frame that get the full zoom
fade_in, fade_out: the number of frames before 'start' and after 'end' where the zoom is animated
x0,y0,x1,y1: the borders that shall be zoomed out. (i.e.: like crop() coordinates)

No support for "keep aspect ratio", and no error checking at all. User must care that the parameters make sense. :)

HartleySan
11th August 2012, 05:33
Very efficient and easy to understand.
Thanks, Didee.