Log in

View Full Version : Turn panoramic image into a movie


Tuesday
30th September 2005, 15:03
Hey, i have a problem:

I have a large image file of a landscape, i made it by taking and image, turning a few degrees and taking another until i had a full panorama.

I have now stiched all these seperate images together using image processing tools.

I would like to create a video in which this image scrolls across the frame of view so that it looks like the camera is turing round to encompass this landscape.

I know there must be a way avisynth can do this but i havnt the foggiest idea of where to start...

any suggestions?

Wilbert
30th September 2005, 15:07
That's possible with Animate, StackVertical and Crop.

Tuesday
30th September 2005, 16:05
hey again,

ive been trying with Animate + crop as you suggested and came up with this:

source=imagereader("F:\*path*\Panorama2.bmp",0,1,25)
Animate(0,1499,"crop", source,0,0,720,576, source,8064,0,720,576)

But the result is a blank 3 frame video :S

the image "Panorama2.bmp" is 8784x576 pixels, is this too large for avisynth to handle or anything like that?

animate was set over 1500 frame to make the video 1 min long a 25fps

Wilbert
30th September 2005, 16:11
the image "Panorama2.bmp" is 8784x576 pixels, is this too large for avisynth to handle or anything like that?
That might very well be the case. Is the bmp itself loaded fine?

animate was set over 1500 frame to make the video 1 min long a 25fps
That's pointless because your source has only one frame. Use Loop(1500) before feeding it to Animate.

gzarkadas
30th September 2005, 16:54
You can try this piece of code (tested and working with an image of your size), which in addition does not require to Loop() your image, because the function uses Overlay for its implementation, and also gives extra abilities in more complex cases (for example you can play with opacity).

Import("{path to avslib installation folder}\headers\avslib-h.avsi")

c = ImageReader("{your image}.bmp", 0, 1, 25)
# create a base clip to overlay c on top of it
base = BlankClip(color=$fffff, width=WSIZE_PAL, height=HSIZE_PAL, length=1500)
# the x and y centers of base clip
bw = Round(base.Width/2)
bh = Round(base.Height/2)
# the x-center of the c clip
cw = Round(c.Width/2)
return LineAnim (http://avslib.sourceforge.net/functions/l.html#LineAnim)(base, c, x_start=cw-bw, x_end=-cw+bw, y_start=bh)


For this to run you will have to download the AVSLib (http://sourceforge.net/projects/avslib/) library in order to use the function and constants named in the script.

Tuesday
30th September 2005, 17:29
I figured out one of the errors: virtualdub had "display input/output video" off, doh!

With that out of the way it does indeed appear that the image is too large to load, when i open the image in vdub i get garbage, and the imagereader is returning an error in the DeVIL library

I tested some image sizes and it appears that images with 4096 width is the limit, which probably makes sense somewhere in the code.

So in the end i simply split the image into 3 sections, which worked a charm

Final code:

leftpic=imagereader("F:\My Documents\My Web Sites\Caravan Site\Part1.bmp",fps=25,end=499)
midpic=imagereader("F:\My Documents\My Web Sites\Caravan Site\Part2.bmp",fps=25,end=499)
rightpic=imagereader("F:\My Documents\My Web Sites\Caravan Site\Part3.bmp",fps=25,end=499)

leftvid=Animate(0,499,"crop", leftpic,0,0,720,576, leftpic,2720,0,720,576)
midvid=Animate(0,499,"crop", midpic,0,0,720,576, midpic,2720,0,720,576)
rightvid=Animate(0,499,"crop", rightpic,0,0,720,576, rightpic,2720,0,720,576)

return leftvid+midvid+rightvid

Thanks a lot to Mr. Wilbert, i hope someone else finds this code useful one day too

Malcolm
4th October 2005, 12:47
Interesting question. Turning a panoramic image into a movie! i was thinking about this a while ago. but panning doesn't solves the problem! You have to take perspective into account! Imagine using one of these panoramic viewers or browser plugins. when turning around horizontally the image isn't just panned! instead it's 'warped' around you. it's hard to explain. here is a perfect and very spetecular example: http://www.fromparis.com/modules/large.php?style=java_fullscreen&pano=000089_01
look at the corners: they move 'faster' than the middle of the image!

Now i'd like to see THIS as a movie! (e.g. one 360 Degree turn in horizontal direction)

Greetings,
Malcolm

Wilbert
4th October 2005, 22:35
@Tuesday,

Could you upload those pics somewhere? I'd like to have a look at it. I think i know how to make what Malcolm suggested. I just need to have some footage :)

Tuesday
6th October 2005, 12:04
Sure, you can find them here:

<dead links>

sorry about using jpg, i'm running outta web space :(

Wilbert
8th October 2005, 22:22
Sorry, i don't know how to do what Malcolm wants. I thought i could use WarpedResize (filter from simpleresize.dll) for this, but i didn't succeed.