CelStabilize

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(fix link and other minor things)
(reformat)
Line 1: Line 1:
CelStabilize - a stabilization script, designed for animations.  The movement typically comes from the process that scans the animation to video; resulting in jerkiness. By mg262.
+
{{FilterCat4|External_filters|Scripts|Restoration_filters|Stabilizers }}
 +
{{Filter3
 +
|mg262
 +
|23rd September 2005
 +
|
 +
|Stabilizers
 +
|
 +
|6=[http://forum.doom9.org/showthread.php?t=100396 Doom9 Thread]}}
 +
 
 +
== Description ==
 +
<tt>CelStabilize</tt> - 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[http://forum.doom9.org/showthread.php?t=100396#post716537]:
 +
# It takes masks specifying regions to ignore.
 +
# 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).
 +
# 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.)
 +
<br>
 +
<br>
 +
== Requirements ==
 +
*AviSynth 2.5.8 or [http://sourceforge.net/projects/avisynth2/ greater]
 +
*Supported color formats: [[YV12]]
 +
 
 +
=== Required Plugins ===
 +
*CelBackground | [http://www.avisynth.nl/users/warpenterprises/files/celbackground_20050923.zip celbackground_20050923.zip]
 +
<br>
 +
== Script ==
 +
<tt>CelStabilise.avs</tt>
  
CelStabilise.avs
 
 
  function Stabilise(clip o, clip metric)
 
  function Stabilise(clip o, clip metric)
 
  {
 
  {
Line 15: Line 48:
 
  return Paper()
 
  return Paper()
 
  }
 
  }
 
+
<br>
Usage:
+
== Examples ==
  LoadPlugin("CelBackground_23Sep05.dll")
+
  [[Plugins|LoadPlugin]]("CelBackground_23Sep05.dll")
  Import("CelStabilise.avs")
+
  [[Internal_functions#Import|Import]]("CelStabilise.avs")<br>
   
+
  [[AviSource]]("blah.avi")
#load clip here
+
  Stabilise(capabsolutemetric(15))<br>
  Stabilise(capabsolutemetric(15))
+
  #[[Crop]](4, 4, -4, -4, align=true) #or as appropriate to remove borders created by stabilization
  #crop(4, 4, -4, -4, true) #or as appropriate to remove borders created by stabilization
+
<br>
 
+
==External Links ==
These are the distinctive features of this filter:
+
*[http://forum.doom9.org/showthread.php?t=100396 Doom9 Forum] - CelBackground/CelStabilise discussion.
 
+
<br>
1. It takes masks specifying regions to ignore.
+
<br>
2. It works on a scene by scene basis and tries to stabilise still scenes completely rather than applying a filter to reduce the motion.*
+
-----------------------------------------------
3. The sensitivity to different luma-differences is specifiable.
+
'''Back to [[External_filters#Stabilization|External Filters]] &larr;'''
*i.e. of each pair of pixels that lie on top of each other.
+
 
+
Edit: I should have said that this is primarily meant for animation, especially old animation, although as far as I can see it should work on live material if the background is reasonably still...
+
 
+
Further discussion: http://forum.doom9.org/showthread.php?t=100396
+
CelBackground plugin dll http://www.avisynth.nl/users/warpenterprises/files/celbackground_20050923.zip
+
 
+
[[Category:External filters]]
+

Revision as of 01:43, 9 August 2015

Abstract
Author mg262
Version 23rd September 2005
Download
Category Stabilizers
License
Discussion Doom9 Thread

Contents

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.)

Requirements

  • AviSynth 2.5.8 or greater
  • Supported color formats: YV12

Required Plugins


Script

CelStabilise.avs

function Stabilise(clip o, clip metric)
{
Selectall(o)
SelectFirstOfRun()
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()
}


Examples

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


External Links




Back to External Filters

Personal tools