View Full Version : Unfurl plugin for stitching into a panorama
vcmohan
4th September 2008, 10:34
In another thread in the Avisynth development section a problem was posed. In summary it is a stationary camera filming a canvas roll. The canvas is rolled up on the left side while on the right side it is unrolled keeping the width of center constant. The amount of roll for each frame may vary within limits.
This plug in solves the problem using frequency domain cross correlations. It therefore needs the fftw dll, which can be downloaded from my plugins page. For a description in detail look here (http://avisynth.org/vcmohan/Unfurl/Unfurl.html).
If sufficient detail to get a good correlation value is lacking then it uses specified shift value for shift.
sh0dan
4th September 2008, 14:26
Impressive filter!
Fizick
4th September 2008, 14:36
Probably you say about this thread ?
http://forum.doom9.org/showthread.php?t=140622
Comatose
4th September 2008, 15:19
Can you please provide sample usage using the video in that thread?
vcmohan
5th September 2008, 12:31
Can you please provide sample usage using the video in that thread?
Is there a way to save the youtube file which I am not aware of?
XhmikosR
5th September 2008, 12:51
You can go to http://keepvid.com/ and paste the link of the youtube video you want to download, if you mean this.:)
It can be done also with different ways, like Unplug extension for Firefox, or OrbitDownloader etc.
Comatose
5th September 2008, 15:16
Ugh, I thought the author of that thread posted a sample because of mikeytown2's post... I guess he only gave it to him :\
edit: oh nm, the YouTube video is good quality :E
Gavino
5th September 2008, 20:41
Can you please provide sample usage using the video in that thread?
Here is what I got using Unfurl(10, 244, 4, 12).
http://img142.imageshack.us/img142/285/mappandluciaufhb6.th.jpg (http://img142.imageshack.us/my.php?image=mappandluciaufhb6.jpg)
The result is a bit disappointing compared to the quality of vcmohan's test results.
By comparison, here is the result of applying my script function
http://img155.imageshack.us/img155/3302/mappandlucia000000re6.th.jpg (http://img155.imageshack.us/my.php?image=mappandlucia000000re6.jpg)
With both results, if you look closely you can make out the joins.
But with Unfurl, although the joins are (maybe) slightly less visible, there are three times as many, so to my eyes more intrusive.
Unfurl seems to blur slightly too.
@vcmohan:
Does Unfurl do resampling or merely crop at pixel boundaries?
Could Unfurl be given a parameter to say how many frames between each join?
vcmohan
6th September 2008, 05:07
The result is a bit disappointing compared to the quality of vcmohan's test results.
Thanks for the post. I will install the download extension and try Unfurl on the clip.
Does Unfurl do resampling or merely crop at pixel boundaries?
Could Unfurl be given a parameter to say how many frames between each join?
Unfurl merely joins at pixel boundaries.No interpolation is done. It joins at every frame. The effect of stitches noticeable is probably due to the rounding off to lower even number in case of non RGB inputs.
The blurring noticed is probably due to insufficient number of good correlations in the frame and it using the given shift parameter.
While it is ok to use parameters without names in this instance, due to modifications, their positions can be different in different versions. Pl use names for arguments.
I will come back in a day.
vcmohan
6th September 2008, 10:37
I downloaded and closely examined input. The input frames have a slight gradation of intensity. It is varying from left to right. The brightness of the sky remains same (with same gradation) even if the image moves.Thats the reason those stitches are seen. I have tried the following also.
ffmpegSource("-----painting.flv")
Trim(19, 484) # select panning sequence
ConvertToRGB32() # avoid cropping restrictions
selectevery(8,0)# stitches every 8 th frame.
Unfurl(shift = 80,min = 36,max = 100, nr = last.height)
While this spaces the stitches farther apart, the gradation effect is clearly seen. However part of the titles also are let in. To avoid the titles use
selectevery(2,0)
Unfurl(shift = 20,min = 10,max = 30, nr = last.height)
To avoid seeing the stitches on this panaroma the input gradation must be removed by any other function. On the input clip (un trimmed frame 40 to 80 or so gradation is very noticeable.
vcmohan
14th September 2008, 09:05
I have tried with the following code.
version()
stackvertical(last,last)
converttorgb24()
trim(1,1)
stackhorizontal(last,last,last,last)
r = crop(0,0,240,0)
cr = canvasroll(last,r,10,24,50,240,0)
cr = selectevery(cr,2,0)
uf = unfurl(cr,shift = 40, min = 20, max = 50, nr = cr.height)
return (uf)
function canvasroll(clip c,clip r, int min, int max, int nframes, int wd, int nw)
{
nw = nw + min + rand(max - min)
r = r + crop(c,nw,0,wd,0)
nframes <= 1 ? r: canvasroll(c,r,min, max,nframes - 1,wd, nw)
}
The output is :
http://img225.imageshack.us/img225/4589/unfurlirandversion0oh4.th.jpg (http://img225.imageshack.us/my.php?image=unfurlirandversion0oh4.jpg)
I am not sure whether the script function of Gavino can handle this.
Gavino
14th September 2008, 17:50
I am not sure whether the script function of Gavino can handle this.
I'm quite sure - it can't. :)
My function was designed for, and assumes, a uniform panning rate, so it always moves the same number of pixels on each iteration.
The great strength of your plugin is that not only does it work out the rate for itself (with mine you have to do this manually), but it also handles a variable rate, which your example demonstrates admirably.
I even tried modifying your example to use non-integral panning steps, by changing canvasroll to
function canvasroll(clip c,clip r, int min, int max, int nframes, int wd, float nw)
{
nw = nw + min + (rand(32768)/32768.0)*(max - min)
r = r + LanczosResize(c,wd,c.height,nw,0,wd,0)
nframes <= 1 ? r: canvasroll(c,r,min, max,nframes - 1,wd, nw)
}
and Unfurl was still able to reconstruct the original image. Excellent!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.