DeScratch

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(DeScratch: add documentation and x64 version)
(update version)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{FilterCat5|External_filters|Plugins|Plugins_x64|Restoration_filters|Film_Damage}}
 
{{FilterCat5|External_filters|Plugins|Plugins_x64|Restoration_filters|Film_Damage}}
 
{{Filter3
 
{{Filter3
| {{Author/Fizick}}
+
|1={{Author/Fizick}}, {{Author/Myrsloik}}
| v1.1.0
+
|2=r1
| [https://web.archive.org/web/20200602001542if_/https://files.videohelp.com/u/223002/DeScratch110.7z DeScratch110.7z]
+
|3=[https://github.com/vapoursynth/descratch/releases descratch-r1.7z]
| Film Restoration
+
|4=Film Restoration
 
|5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
|5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 
|6=[https://forum.doom9.org/showthread.php?t=67794 Doom9 Forum]}}
 
|6=[https://forum.doom9.org/showthread.php?t=67794 Doom9 Forum]}}
Line 11: Line 11:
 
This plugin removes vertical scratches from films. Also it can be used for removing of horizontal noise lines such as drop-outs from analog VHS captures (after image rotation).  
 
This plugin removes vertical scratches from films. Also it can be used for removing of horizontal noise lines such as drop-outs from analog VHS captures (after image rotation).  
  
*See official documentation: http://avisynth.org.ru/descratch/descratch.html
+
*See official documentation: http://www.avisynth.nl/users/fizick/descratch/descratch.html
 
<br>
 
<br>
 +
 
== Requirements ==
 
== Requirements ==
* [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6]
 
 
* [x64]: [[AviSynth+]]
 
* [x64]: [[AviSynth+]]
*Supported color formats: [[YUY2]], [[YV12]]
+
*Supported color formats: [[YV12]], [[YV16]], [[YV24]]
 
<br>
 
<br>
  
Line 28: Line 28:
 
::{{Par2|mindif|int|5}}
 
::{{Par2|mindif|int|5}}
 
:::Minimal difference of pixel value in scratch from neighbours pixels for luma plane.
 
:::Minimal difference of pixel value in scratch from neighbours pixels for luma plane.
:Range: from 1 to 255, default 5
+
:::Range: from 1 to 255, default 5
 
<br>
 
<br>
 
::{{Par2|asym|int|10}}
 
::{{Par2|asym|int|10}}
Line 91: Line 91:
 
<br>
 
<br>
 
<br>
 
<br>
 +
 
==How It Works==
 
==How It Works==
 
The plugin firstly detects scratches, then removes them.<br>
 
The plugin firstly detects scratches, then removes them.<br>
Line 127: Line 128:
 
!!width="150px"| Mirror
 
!!width="150px"| Mirror
 
|-
 
|-
!v1.1.0 (x86/x86)
+
!v1.1.0 (x86/x64)
 
|[https://web.archive.org/web/20200602001542if_/https://files.videohelp.com/u/223002/DeScratch110.7z DeScratch110.7z]
 
|[https://web.archive.org/web/20200602001542if_/https://files.videohelp.com/u/223002/DeScratch110.7z DeScratch110.7z]
 
|[https://web.archive.org/web/20191106173207if_/http://www.iol.ie/%7Eschubert/gas/DeScratch110.7z DeScratch110.7z] /// [http://www.mediafire.com/file/wqvpodrpu1nfd0b/DeScratch110.7z/file MediaFire]
 
|[https://web.archive.org/web/20191106173207if_/http://www.iol.ie/%7Eschubert/gas/DeScratch110.7z DeScratch110.7z] /// [http://www.mediafire.com/file/wqvpodrpu1nfd0b/DeScratch110.7z/file MediaFire]
Line 135: Line 136:
 
|[https://web.archive.org/web/20200602001754if_/http://avisynth.org.ru/descratch/descratch110.zip descratch110.zip]
 
|[https://web.archive.org/web/20200602001754if_/http://avisynth.org.ru/descratch/descratch110.zip descratch110.zip]
 
|}
 
|}
* x86/x84 version compiled by [https://forum.doom9.org/showthread.php?t=173259 Groucho2004].
+
* x86/x64 version compiled by [https://forum.doom9.org/showthread.php?t=173259 Groucho2004].
 
<br>
 
<br>
 +
 
== External Links ==
 
== External Links ==
 
<br>
 
<br>

Latest revision as of 18:40, 29 October 2023

Abstract
Author Fizick, Myrsloik
Version r1
Download descratch-r1.7z
Category Film Restoration
License GPLv2
Discussion Doom9 Forum


Contents

[edit] Description

This plugin removes vertical scratches from films. Also it can be used for removing of horizontal noise lines such as drop-outs from analog VHS captures (after image rotation).


[edit] Requirements


[edit] Syntax and Parameters

descratch (clip, int "mindif", int "asym", int "maxgap", int "maxwidth", int "minlen", int "maxlen", float "maxangle", int "blurlen", int "keep", int "border", int "modeY", int "modeU", int "modeV", int "mindifUV", bool "mark", int "minwidth", int "left", int "right")


clip   =
Input clip.


int  mindif = 5
Minimal difference of pixel value in scratch from neighbours pixels for luma plane.
Range: from 1 to 255, default 5


int  asym = 10
Maximal asymmetry of neighbors pixels
Range: from 0 to 255, default 10


int  maxgap = 3
Maximal vertical gap to be closed.
Range: from 0 to 255, default 3


int  maxwidth = 3
Maximal scratch width.
Range: odd numbers from 1 to 15, default=3


int  minlen = 100
minimal scratch length, (default = 100).


int  maxlen = 2048
Maximal scratch length, (default = 2048).


float  maxangle = 5.0
Maximal angle to vertical (in degrees, default = 5.0).


int  blurlen = 15
Radius of vertical blur for frame analysis (default = 15).


int  keep = 100
Percent of scratch detail to keep (default = 100).


int  border = 2
Thickness of border near scratch for partial restoration (default = 2).


int  modeY = 1
Processing mode for luma plane (0 - no, 1 - low(black), 2 - high(white), 3 - both, default=1).


int  modeU = 0
Processing mode for chroma U plane (0 - no, 1 - low(green), 2 - high(red), 3 - both, default=0).


int  modeV = 0
Processing mode for chroma V plane (0 - no, 1 - low(yellow), 2 - high(blue), 3 - both, default=0).


int  mindifUV = 0
Minimal difference of pixel value in scratch from neighbours pixels for chroma planes.
Range: from 0 to 255, default 0:
  • if = 0, then internal mindifUV value is same as mindif.


bool  mark = false
Mark scratch in debug mode (true or false, default = false).
(set rejected extrems pixels to grey, set scratches pixels to white or black)


int  minwidth = 1
Minimal scratch width.
Range: odd numbers from 1 to 15, default=1


int  left = 0
Left margin of processing window (inclusive), default=0.


int  right =
Right margin of processing window (exclusive), default=frame width or 4096.


Parameters maxgap, maxwidth, minwidth, minlen, blurlen, border, left, right should be given in pixels.



[edit] How It Works

The plugin firstly detects scratches, then removes them.
It uses spatial information only from current frame.
I adapt it to restoration of my old 8 mm films, may be it will be useful to somebody else.

Scratch detecting

Apply some vertical blur to frame copy, for suppression of image thin structure, inclined lines and noise.
Search for local extremes of luma in every row with luma difference criterion for scratches with width not above a max.
Put these extremes in some map (frame). Search and deactivate extrems for width below a min (optional).
Optionally close vertical gaps in extrems by vertical expanding of extreme points.
Test the extremes map with length and angle criterions, so select real long scratches only.

Scratch removing

Scratches may be either partially transparent, smooth (with image details), or opaque (with no details or almost destroyed).
In the first case, plugin can subtract smooth (blurred) part of luma scratches variation from original image. Therefore, image details are kept.
In the second case, plugin replaces scratched pixels by mean luma values from some neighbours pixels (in same row).
We have also intermediate case by setting some percent of detail to keep.
In all cases, some nearest neighbours pixels may be also partially changed for smooth transition.

[edit] Examples

descratch default settings:

AviSource("Blah.avi")
descratch ()

You MUST tune parameters for your video.
Use AviSynth commands Greyscale(), UtoY(), VtoY(), and mark parameter for debug and tuning.

[edit] Archived Downloads

Version Download Mirror
v1.1.0 (x86/x64) DeScratch110.7z DeScratch110.7z /// MediaFire
v1.1.0 descratch110.zip descratch110.zip


[edit] External Links




Back to External Filters


Personal tools