DeVCR

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(reformat)
m (Syntax and Parameters: correction)
 
Line 24: Line 24:
 
<br>
 
<br>
 
::{{Par2| |clip| }}
 
::{{Par2| |clip| }}
:::Input clip; YUV and RGB colorspaces accepted. Clip is converted to RGB.
+
:::Input clip; 8-bit YUV and RGB colorspaces accepted.
 
<br>
 
<br>
 
::{{Par2||int|}}
 
::{{Par2||int|}}
 
:::<code>threshold</code>
 
:::<code>threshold</code>
 
<br>
 
<br>
 +
 
== Script ==
 
== Script ==
 
<pre>
 
<pre>

Latest revision as of 00:28, 23 June 2020

Abstract
Author Ricardo Garcia
Version v1.0
Download Script
Category VHS Restoration
License
Discussion VideoHelp


Contents

[edit] Description

This filter elliminates (to a certain degree) the annoying horizontal lines that keep crawling around your VHS or Beta recorded video. The algorithm: Calculate the difference between each pixel and the pixels above and below (it's horizontal noise we're dealing with), and average large portions (resizing the clip to 16 pixels wide is more than enough) of it to detect the horizontal noise. Then check the difference with the next frame and see if it's effectively temporal noise. After it's detected, just replace each pixel in the noise for the corresponding pixel in the next frame.


[edit] Requirements


[edit] Syntax and Parameters

deVCR (clip c, int threshold)


clip   =
Input clip; 8-bit YUV and RGB colorspaces accepted.


int   =
threshold


[edit] Script

function DetectVCRLines(clip c,int threshold)
{
  spacial_data = GeneralConvolution(ConvertToRGB(c),0,"0 -1 0 0 2 0 0 -1 0")
  bar_data = ConvertToRGB(BilinearResize(spacial_data,16,c.height))
  st_data = Overlay(bar_data,Trim(bar_data,1,0),mode = "subtract")
  st_data2 = Greyscale(Levels(st_data,threshold,10.0,threshold+1,0,255,coring = false))
  st_data3 = Greyscale(Levels(st_data2,127,10.0,128,0,255,coring = false))
  st_data4 = Overlay(st_data3,st_data3,y = -1, mode = "add")
  return PointResize(st_data4,c.width,c.height)
}

function deVCR(clip c,int threshold)
{
  mybars = DetectVCRLines(c,threshold)
  return Overlay(c,Trim(c,1,0), mask = mybars,greymask = true)  
}


[edit] Examples

Usage example:

myclip = AVISource("vcr.avi")
fixedclip = deVCR(myclip,30)
StackHorizontal(myclip,fixedclip,Overlay(myclip,fixedclip,mode = "subtract"))

Here is a result of the filter (original, filtered, diff):

Devcr.jpg

[edit] External Links

  • DigitalFAQ - Tracking lines in video; how to fix these VHS tapes?




Back to External Filters


Personal tools