DeVCR
From Avisynth wiki
(Difference between revisions)
m (1 revision) |
m (→Syntax and Parameters: correction) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{FilterCat4|External_filters|Scripts|Restoration_filters|Film_Damage}} | |
+ | {{Filter3 | ||
+ | | Ricardo Garcia | ||
+ | | v1.0 | ||
+ | | [[#Script|Script]] | ||
+ | | VHS Restoration | ||
+ | | | ||
+ | |6=[http://forum.videohelp.com/threads/323093-How-to-use-DeVCR-for-Avisynth VideoHelp]}} | ||
+ | <br> | ||
+ | == 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. | ||
− | + | <br> | |
− | + | ||
− | + | ||
− | + | ||
− | + | == Requirements == | |
− | + | * [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6] | |
− | + | * [x64]: [[AviSynth+]] | |
− | + | *Supported color formats: 8-bit RGB and YUV | |
− | + | <br> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | == [[Script variables|Syntax and Parameters]] == | ||
+ | |||
+ | :{{Template:FuncDef|deVCR (clip c, int threshold)}} | ||
+ | <br> | ||
+ | ::{{Par2| |clip| }} | ||
+ | :::Input clip; 8-bit YUV and RGB colorspaces accepted. | ||
+ | <br> | ||
+ | ::{{Par2||int|}} | ||
+ | :::<code>threshold</code> | ||
+ | <br> | ||
+ | |||
+ | == Script == | ||
+ | <pre> | ||
+ | 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) | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | == Examples == | ||
Usage example: | Usage example: | ||
Line 32: | Line 60: | ||
[[Image:devcr.jpg]] | [[Image:devcr.jpg]] | ||
− | + | <br> | |
− | + | <br> | |
− | + | == External Links == | |
− | [[ | + | *[http://www.digitalfaq.com/forum/video-restore/2607-tracking-lines-video.html DigitalFAQ] - Tracking lines in video; how to fix these VHS tapes? |
+ | <br> | ||
+ | <br> | ||
+ | ----------------------------------------------- | ||
+ | '''Back to [[External_filters#Film_Damage_correction|External Filters]] ←''' | ||
+ | ----------------------------------------------- |
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
- [x86]: AviSynth+ or AviSynth 2.6
- [x64]: AviSynth+
- Supported color formats: 8-bit RGB and YUV
[edit] Syntax and Parameters
- deVCR (clip c, int threshold)
- clip =
- Input clip; 8-bit YUV and RGB colorspaces accepted.
- clip =
- int =
threshold
- int =
[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):
[edit] External Links
- DigitalFAQ - Tracking lines in video; how to fix these VHS tapes?
Back to External Filters ←