Median

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(fix links)
m (typo)
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
{{FilterCat4|External_filters|Plugins|Adjustment_filters|Averaging}}
+
{{FilterCat6|External_filters|Plugins|Plugins_x64|Adjustment_filters|Averaging|Deep_color_tools}}
 
{{Filter3
 
{{Filter3
 
| {{Author/ajk}}
 
| {{Author/ajk}}
| v0.6
+
| v0.6-RGB64
|[http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6.zip Median-0.6.zip]
+
|[http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6-RGB64-32+64bit.zip Median-0.6-RGB64-32+64bit.zip]
 
| Averaging
 
| Averaging
 
| ''Public domain. Credit would be nice, but do with this what you will.''
 
| ''Public domain. Credit would be nice, but do with this what you will.''
Line 15: Line 15:
  
 
== Requirements ==
 
== Requirements ==
* AviSynth 2.5.8 or [http://sourceforge.net/projects/avisynth2/ greater]
+
* [x86] [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0]
 +
* [x64] [[AviSynth+]]
 
* Supported color formats: [[YUY2]], [[YV12]], [[RGB32]], [[RGB24]]
 
* Supported color formats: [[YUY2]], [[YV12]], [[RGB32]], [[RGB24]]
 +
**AviSynth+: [[RGB64]] is also supported
 
<br>
 
<br>
 
 
== [[Script variables|Syntax and Parameters]] ==
 
== [[Script variables|Syntax and Parameters]] ==
  
Line 43: Line 44:
 
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().
 
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().
 
<br>
 
<br>
:{{Template:FuncDef|Median (clip, clip, clip, ..., int "low", int "high", bool "chroma", int "sync", int "samples", bool "debug")}}
+
:{{Template:FuncDef|MedianBlend (clip, clip, clip, ..., int "low", int "high", bool "chroma", int "sync", int "samples", bool "debug")}}
 
<br>
 
<br>
 
::{{Par2| |clip| }}
 
::{{Par2| |clip| }}
Line 65: Line 66:
 
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().
 
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().
 
<br>
 
<br>
:{{Template:FuncDef|Median (clip, int "radius", bool "chroma", bool "debug")}}
+
:{{Template:FuncDef|TemporalMedian (clip, int "radius", bool "chroma", bool "debug")}}
 
<br>
 
<br>
 
::{{Par2| |clip| }}
 
::{{Par2| |clip| }}
Line 102: Line 103:
 
== Changelog ==
 
== Changelog ==
 
  Version      Date            Changes<br>
 
  Version      Date            Changes<br>
  v0.6         16/01/2016      - Added automatic clip synchronisation.
+
  v0.6-RGB64  2019/02/01     - Changes by TomArrow[https://forum.doom9.org/showpost.php?p=1864406&postcount=55]
  v0.5        15/03/2014     - Fixed bug with chroma=false. Added TemporalMedian() functionality.
+
                              - Support RGB64 (but not the fast processing mode that's supported in the 8-bit color spaces)
  v0.4        14/02/2014     - Added MedianBlend() functionality.
+
                              - Implement the new AviSynth+ API (V6)
  v0.3        13/02/2014     - Fixed output frame buffer issue.
+
                              - Have both 32 bit and 64 bit platforms set up for VS 2017
  v0.2        13/02/2014     - Added support for other colour spaces (planar and RBG24/32).
+
v0.6        2016/01/16     - Added automatic clip synchronisation.
  v0.1        12/02/2014     - Initial release. YUY2 support only.
+
  v0.5        2014/03/15     - Fixed bug with chroma=false. Added TemporalMedian() functionality.
 +
  v0.4        2014/02/14     - Added MedianBlend() functionality.
 +
  v0.3        2014/02/13     - Fixed output frame buffer issue.
 +
  v0.2        2014/02/13     - Added support for other colour spaces (planar and RBG24/32).
 +
  v0.1        2014/02/12     - Initial release. YUY2 support only.
 
<br>
 
<br>
 
== Archived Downloads ==
 
== Archived Downloads ==
Line 115: Line 120:
 
!!width="150px"| Download
 
!!width="150px"| Download
 
!!width="150px"| Mirror
 
!!width="150px"| Mirror
 +
|-
 +
!v0.6-RGB64
 +
|[http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6-RGB64-32+64bit.zip Median-0.6-RGB64-32+64bit.zip]
 +
|[https://web.archive.org/web/20200317171732if_/http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6-RGB64-32+64bit.zip Median-0.6-RGB64-32+64bit.zip]
 
|-
 
|-
 
!v0.6
 
!v0.6
|[http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6.zip Median-0.6.zip]
+
|[http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6.zip Median-0.6.zip]<br>[http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6-x64.zip Median-0.6-x64.zip]
|[http://web.archive.org/web/20170218121220/http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6.zip Median-0.6.zip]
+
|[http://web.archive.org/web/20170218121220/http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6.zip Median-0.6.zip]<br>[https://web.archive.org/web/20200317171657/http://ajk.kapsi.fi/projects/avisynth/median-plugin/Median-0.6-x64.zip Median-0.6-x64.zip]
 
|}
 
|}
For older versions take a look at [http://ajk.kapsi.fi/projects/avisynth/median-plugin/ ajk's repository] ([http://web.archive.org/web/20170218121220/http://ajk.kapsi.fi/projects/avisynth/median-plugin/ archived]).
+
For older versions take a look at [http://ajk.kapsi.fi/projects/avisynth/median-plugin/ ajk's repository] ([https://web.archive.org/web/20200317171657/http://ajk.kapsi.fi/projects/avisynth/median-plugin/ archived]).
 
<br>
 
<br>
 
<br>
 
<br>
 +
 
== External Links ==
 
== External Links ==
 +
*[https://github.com/dubhater/vapoursynth-median GitHub] - VapourSynth port
 
<br>
 
<br>
 
<br>
 
<br>
 
-----------------------------------------------
 
-----------------------------------------------
 
'''Back to [[External_filters#Averaging.2FLayering.2FMasking|External Filters]] &larr;'''
 
'''Back to [[External_filters#Averaging.2FLayering.2FMasking|External Filters]] &larr;'''

Latest revision as of 02:04, 2 October 2021

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


Contents

[edit] 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.

[edit] Requirements


[edit] Syntax and Parameters

[edit] 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.


[edit] 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().

MedianBlend (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


[edit] 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().

TemporalMedian (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



[edit] 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)


[edit] Changelog

Version      Date            Changes
v0.6-RGB64 2019/02/01 - Changes by TomArrow[1] - Support RGB64 (but not the fast processing mode that's supported in the 8-bit color spaces) - Implement the new AviSynth+ API (V6) - Have both 32 bit and 64 bit platforms set up for VS 2017 v0.6 2016/01/16 - Added automatic clip synchronisation. v0.5 2014/03/15 - Fixed bug with chroma=false. Added TemporalMedian() functionality. v0.4 2014/02/14 - Added MedianBlend() functionality. v0.3 2014/02/13 - Fixed output frame buffer issue. v0.2 2014/02/13 - Added support for other colour spaces (planar and RBG24/32). v0.1 2014/02/12 - Initial release. YUY2 support only.


[edit] Archived Downloads

Version Download Mirror
v0.6-RGB64 Median-0.6-RGB64-32+64bit.zip Median-0.6-RGB64-32+64bit.zip
v0.6 Median-0.6.zip
Median-0.6-x64.zip
Median-0.6.zip
Median-0.6-x64.zip

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

[edit] External Links




Back to External Filters

Personal tools