Median

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(fix links)
m (add x64 category)
Line 1: Line 1:
{{FilterCat4|External_filters|Plugins|Adjustment_filters|Averaging}}
+
{{FilterCat5|External_filters|Plugins|Plugins_x64|Adjustment_filters|Averaging}}
 
{{Filter3
 
{{Filter3
 
| {{Author/ajk}}
 
| {{Author/ajk}}

Revision as of 21:50, 16 March 2020

Abstract
Author ajk
Version v0.6
Download Median-0.6.zip
Category Averaging
License Public domain. Credit would be nice, but do with this what you will.
Discussion Doom9 Thread, VideoHelp Thread


Contents

Description

Median.dll is a filter plugin for AviSynth which generates a pixel-by-pixel median of several clips. This is particularly useful for filtering out noise and glitches from multiple VHS/SVHS/8mm/Hi8 tape captures, but can be used for other purposes also.

Requirements


Syntax and Parameters

Median

Median() is the namesake function for this filter package. It takes a number of clips and outputs a frame which is the median of the input. Because for noise filtering applications having all the input clips exactly in sync is important, it also includes functionality to line up slight mismatches that can be present due to framedrops during capture.

Median (clip, clip, clip, ..., bool "chroma", int "sync", int "samples", bool "debug")


clip   =
Input clips between 3 and 25 are accepted. Odd number of clips is required.


bool  chroma = true
Chroma is processed by default, but this can be turned off in which case the chroma from the first clip is used. In the case of RGB input, all colour planes are always processed. With RGB32 the chroma parameter can be used to turn off alpha channel processing.


int  sync = 0
If the clips are not exactly in sync, you can use this parameter to automatically line them up. The plugin will search up to this number of preceding and following frames to find the best match.


int  samples = 4096
Number of pixels to compare when determining similarity of frames for synchronization. The default seems to be fine most of the time but this parameter allows you to tweak the process.


bool  debug = false
Turns on debug output.


MedianBlend

There is also another, more flexible filter included, MedianBlend(). This function can be adjusted to for example return a clip derived from the minimum or maximum pixel values, or to discard some low (default: 1) and high (default: 1) values and blend the others together. With the paramteters set to not discard anything, the result is in fact the average of the clips. The other parameters work the same way as for Median().

Median (clip, clip, clip, ..., int "low", int "high", bool "chroma", int "sync", int "samples", bool "debug")


clip   =
Input clips between 3 and 25 are accepted.


int  low = 1
Number of low (dark) samples to discard.


int  high = 1
Number of high (light) samples to discard.


bool  chroma = true


int  sync = 0


int  samples = 4096


bool  debug = false


TemporalMedian

You can also use the filter temporally on a single source clip. You can use a radius of up to 12 and the filter will take that many preceding and following frames into account when calculating the median. The other parameters work the same way as for Median().

Median (clip, int "radius", bool "chroma", bool "debug")


clip   =
Input clip.


int  radius = 1
Number of preceding and following frame to consider when calculating the median.


bool  chroma = true


bool  debug = false



Examples

Median of three clips, chroma is not processed:

clip1 = AVISource("capture1.avi")
clip2 = AVISource("capture2.avi")
clip3 = AVISource("capture3.avi")
Median(clip1,clip2,clip3, chroma=false)

Median of three clips, match frames up to 10 frames forward and back, print debug data on the image:

Median(clip1,clip2,clip3, sync=10, debug=true)


Discard no values, output is an average function

 MedianBlend(clip1,clip2,clip3, low=0, high=0)

Discard highest values, output is a minimum function

MedianBlend(clip1,clip2,clip3, low=0, high=2)

Discard lowest values, output is a maximum function

MedianBlend(clip1,clip2,clip3, low=2, high=0)

Discard highest and lowest value and average the two remaining ones

MedianBlend(clip1,clip2,clip3,clip4, low=1, high=1)


Median of five frames: current, two preceding, and two following:

TemporalMedian(clip, radius=2)


Changelog

Version      Date            Changes
v0.6 16/01/2016 - Added automatic clip synchronisation. v0.5 15/03/2014 - Fixed bug with chroma=false. Added TemporalMedian() functionality. v0.4 14/02/2014 - Added MedianBlend() functionality. v0.3 13/02/2014 - Fixed output frame buffer issue. v0.2 13/02/2014 - Added support for other colour spaces (planar and RBG24/32). v0.1 12/02/2014 - Initial release. YUY2 support only.


Archived Downloads

Version Download Mirror
v0.6 Median-0.6.zip Median-0.6.zip

For older versions take a look at ajk's repository (archived).

External Links




Back to External Filters

Personal tools