From Avisynth wiki
Revision as of 03:15, 9 August 2015 by Reel.Deal (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Author mg262
Version 23rd September 2005
Category Stabilizers
Discussion Doom9 Thread


[edit] Description

CelStabilize - a stabilization script, designed for animations. The movement typically comes from the process that scans the animation to video; resulting in jerkiness. Just to emphasize, this filter is primarily meant for animation, especially old animation, although it should work on live material if the background is reasonably still.

These are the distinctive features of this filter[1]:

  1. It takes masks specifying regions to ignore.
  2. It works on a scene by scene basis and tries to stabilize still scenes completely rather than applying a filter to reduce the motion (this isn't "better" than the alternatives -- they're suitable for different tasks).
  3. The sensitivity to different luma-differences is specifiable.

3 is a bit cryptic, so here is some explanation. When you try to stabilize the motion, you are roughly doing this: take frame n+1, put it on top of frame n, and slide it around until you find a good match. (Think of n+1 as semitransparent.) The standard ways to judge how good a match are

A) add up the differences of the luma values (i.e. of each pair of pixels that lie on top of each other.)
B) add up the squares of the differences of the luma values. So you slide around n+1 to try and make this number as small as possible.

Both methods say that a white object "matches" a black background much worse than a grey object does -- whereas in fact, they are equally bad. Above a certain level, depending on noise but always relatively small, bigger differences don't mean anything... so the filter lets you specify the "penalty" for each luma difference. (+this has subtler uses which I won't go into now.)

[edit] Requirements

  • AviSynth 2.5.8 or greater
  • Supported color formats: YV12

[edit] Required Plugins

[edit] Script


function Stabilise(clip o, clip metric)
scene = Breakon(last)
FindIntegerPan (o, metric)
UnmaskedRefinePan(o, metric, last)
motion = last.ScaleMotion(-1.0)
totalmotion = AccumulateMotion(scene, motion)
# Stabilise
ApplyUnmaskedPowerTranslate(o, totalmotion, o)#.Expand(900, 640))
return Paper()

[edit] Examples

AviSource("blah.avi") Stabilise(capabsolutemetric(15))
#Crop(4, 4, -4, -4, align=true) #or as appropriate to remove borders created by stabilization

Identical to the sample above but written differently:

metric = CapAbsoluteMetric(last, 15) 
Stabilise(last, metric)

[edit] External Links

Back to External Filters

Personal tools