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. |
29th July 2012, 00:56 | #1 | Link |
Registered User
Join Date: Jan 2012
Location: Sweden
Posts: 22
|
Stabilize via sprocket holes?
I have a short film that is less than a minute long that I have captured with a digital camera and slide copier. The frames are captured entirely, including the sprocket holes. I want to stabilize the film but I don't want to use Depan or Deshaker because it is hard to tweak from scene to scene and it ends up cutting off some of the image at times.
Is it possible to somehow in Avisynth align the sprocket holes of each frame to match the first frame? Thanks in advance. Even if the answer is simply no it will save me some time . |
30th July 2012, 06:54 | #3 | Link |
Registered User
Join Date: Dec 2004
Location: Terneuzen, Zeeland, the Netherlands, Europe, Earth, Milky Way,Universe
Posts: 689
|
With Depan, it is possible to do the motion detection on the sprocket holes only, and then apply the result on the entire clip.
Please try this script: Code:
# film stabilisation script by videoFred. # modified june 2012 #============================================================================================= film= "C:\Users\You\Documents\Yourfile.avi" # source clip, you must specify the full path here #PARAMETERS #---------------------------------------------------------------------------------------------------------------------------- result="stabS" # specify the wanted output here stab= stabilised clip, stabS= comparison before/after trim_begin=2 play_speed= 18 #trim frames and play speed #SIZE, CROP AND BORDERS PARAMETERS #---------------------------------------------------------------------------------------------------------------------------- CLeft=20 CTop=20 CRight=20 CBottom=20 #crop values after Depan and before final resizing W=720 H=576 #final size after cropping bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150 #STABILISING PARAMETERS, YOU REALY MUST USE STABS TO CHECK STABILISATION! #---------------------------------------------------------------------------------------------------------------------------- maxstabH=40 maxstabV=40 #maximum values for the stabiliser (in pixels) 20 is a good start value est_left=40 est_top=40 est_right=40 est_bottom=40 #crop values for special Estimate clip trust_value= 1.0 # scene change detection, higher= more sensitive cutoff_value= 0.5 # no need to change this, but you can play with it and see what you get # END VARIABLES, BEGIN SCRIPT #================================================================================================================================= SetMemoryMax(800) #set this to 1/3 of the available memory Loadplugin("plugins/Depan.dll") LoadPlugin("plugins/DepanEstimate.dll") source1= AviSource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12() #STABILIZING/CROPPING #.......................................................................................................................................... stab_reference= source1.crop(est_left,est_top,-est_right,-est_bottom) mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV) stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15) stab2= stab.crop(CLeft,CTop,-CRight,-CBottom) stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true) WS= width(stab) HS= height(stab) stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS) stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5) #RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5 #.................................................................................................................................................. result5= overlay(source1,greyscale(stab_reference),x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS) #PARAMETERS FOR THE COMPARISONS #.................................................................................................................................................. W2= W+bord_left+bord_right H2= H+bord_top+bord_bot source4=Lanczos4Resize(source1,W2,H2) #SPECIAL COMPARISON CLIP FOR TESTING THE STABILIZER #......................................................................................................................................................................... stabS= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2),\ subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5)).converttoYUY2() Eval(result) Fred.
__________________
About 8mm film: http://www.super-8.be Film Transfer Tutorial and example clips: https://www.youtube.com/watch?v=W4QBsWXKuV8 More Example clips: http://www.vimeo.com/user678523/videos/sort:newest |
30th July 2012, 21:24 | #5 | Link |
Registered User
Join Date: Jan 2012
Location: Sweden
Posts: 22
|
Thanks. Jmac and VideoFred. I have tried both methods now and they both work fairly well.
Centertracker works very good other than the fact that I can't seem to get it to show the whole frame when I'm selecting the area for stabilization. (EDIT: What I mean is that centertracker will open and process the video but the GUI will only show a portion of the frame during area selection) This kind of prevents me from selecting exactly the area I would like. The frames were captured at around 2k resolution. If I could find a way to use centertracker with high resolution video it would be perfect. Video Fred's script would also work quite well I think but I can't seem to crop down to an area small enough to select only the sprocket holes. It keeps telling me this: DepanEstimate: DXMAX must be less than WINX/2! It also doesn't stabilize as well as centertracker but it is pretty acceptable. Last edited by althor1138; 30th July 2012 at 21:28. |
30th July 2012, 21:38 | #6 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,691
|
I know that you have already rejected the idea of using Deshaker, but I thought I should nonetheless point out that it does provide the ability to focus just on the outside edges of the video. You use the "Ignore Pixels" settings which lets you define areas of the image that you wish to ignore (the center, from top to bottom, in your case). Deshaker will then stabilize just on the sprockets.
|
30th July 2012, 21:45 | #7 | Link |
Registered User
Join Date: Jan 2012
Location: Sweden
Posts: 22
|
I have tried it with many different settings and it never reliably seems to lock onto anything. A person I know has attempted the same thing and even talked with Gunnar about the problem and he said that it wouldn't work so well. Something about the light in the sprocket holes or something. I see that he has a newer version out since the last time I tried it so maybe it will produce better results?
|
30th July 2012, 21:55 | #8 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
Hi,
Fixing these problems is easy Just crop to the sprocket holes yourself, save that as a script, then load the script as a video to centertracker. Then use it's output but compensate the coordinates to fix the whole frame, if you know what I mean. |
30th July 2012, 22:16 | #9 | Link | |
Registered User
Join Date: Jan 2012
Location: Sweden
Posts: 22
|
Quote:
The auto-generated avs file is flawed though. I had to create a variable that makes a blankclip from the source vid and feed it to scriptclip. |
|
31st July 2012, 09:29 | #10 | Link | |
Registered User
Join Date: Dec 2004
Location: Terneuzen, Zeeland, the Netherlands, Europe, Earth, Milky Way,Universe
Posts: 689
|
Quote:
maxstabH=10 (or less) maxstabV=10 Fred.
__________________
About 8mm film: http://www.super-8.be Film Transfer Tutorial and example clips: https://www.youtube.com/watch?v=W4QBsWXKuV8 More Example clips: http://www.vimeo.com/user678523/videos/sort:newest |
|
3rd August 2012, 22:08 | #11 | Link |
Registered User
Join Date: Jan 2012
Location: Sweden
Posts: 22
|
Thanks a bunch. It now works great and I can crop to the portion I want to.
As a side thing I'm wondering if anybody knows a good way of aligning the optical audio from a second worth of frames into 1 long frame? |
24th August 2012, 18:57 | #13 | Link | |
Registered User
Join Date: Apr 2011
Posts: 3
|
Quote:
http://opencv.willowgarage.com/documentation/c/highgui_qt_new_functions.html however, with the smaller image choosing the area becomes impossible. I will keep an eye on that issue and if there's a solution I'll implement it. Thus, setting the screen resolution to the desired dimensions (if possible) is the only method to deal with it so far. Stephan ps. sry for the late reply, just found the topic |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|