Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th November 2023, 16:25   #1  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 703
Extract vertical scratches from silent films

So I have been using Spotless followed by makediff before and after it. Works good most of the time to extract the dust and sporadic scratches yet some frames needs to be removed as the filtering sometimes catches movement in the scene etc.

The next step I was hoping to extract vertical (almost static) scratches but it seems harder than I thought.
DestripeV is the only script that has been working somewhat to recognize the vert-scratches but alot of other things are detected and makes for unusable result.

My idea is that somehow make a detection and isolation of the vertical "anomalies" in the image that are scratches.

I have tried to isolate the scratches by masking with ex_edge("kroon") and inverted overlayed motion masks but to no avail.

May need another approach, ideas?
anton_foy is offline   Reply With Quote
Old 27th November 2023, 17:14   #2  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Have a look at the discussion about ProPainter in this recent thread:

Big green line removal with overlay mask possible?

Go to post #16.

Until seeing that thread, I would have told you that scratch removal was impossible without a lot of manual intervention because scratches persist from one frame to the next, so you can't use the trick of looking at something which doesn't exist in either the previous or next frame and then removing that (this is how dust removal algorithms work).
johnmeyer is offline   Reply With Quote
Old 27th November 2023, 17:43   #3  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
I would additionally recommend trying DeScratch.
(First DeScratch, afterwards SpotLess or similar was often a good approach.)
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 27th November 2023, 20:49   #4  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
By all means try Descratch. It is very easy to set up and use. However, I've never had it do anything very useful, so don't get your hopes up too high.
johnmeyer is offline   Reply With Quote
Old 28th November 2023, 08:15   #5  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 703
Thanks everyone, I did not yet try ProPainter but Descratch I have tried and have tweaked and adjusted the params but it seems to miss the scratches mostly and instead identifies other objects as such. Gotta be more careful which scenes I pick to do this on.
anton_foy is offline   Reply With Quote
Old 28th November 2023, 12:06   #6  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Can you share your sample?
kedautinh12 is offline   Reply With Quote
Old 28th November 2023, 12:38   #7  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 703
Quote:
Originally Posted by kedautinh12 View Post
Can you share your sample?
Yes of course thanks! I will this evening.
anton_foy is offline   Reply With Quote
Old 28th November 2023, 16:59   #8  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
The big problem with Descratch is that (I think) it is basically a static inpainter, like a delogo filter. However, scratches wander slightly from frame to frame and therefore are not static enough for the painting to work consistently.
johnmeyer is offline   Reply With Quote
Old 28th November 2023, 20:39   #9  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 703
Re
Quote:
Originally Posted by kedautinh12 View Post
Can you share your sample?
it is 5gb
Problem is that I have to do selectevery(3, 1, 4).selectodd()
Otherwise I get duplicate frames.

link to youtube video: https://www.youtube.com/watch?v=LVV7UutK0Xk

My script so far:
Code:
converttoyv12()
Crop(482, 0, -480, 0)
u=last
cd=convertToYv12()
pr=cd.ex_median("IQMV",Y=3,UV=1)
pre=pr.ex_sbr(3,uv=1)

/*
mo=mmask2()
es=ex_edge("kroon").overlay(mode="darken",mo.invert().mt_expand())
ds=es.descratch(mindif = 12, asym = 6, maxgap = 3, maxwidth = 7).DeStripeV(3,1,255,uv=1).overlay(mode="darken",mo.invert().mt_expand())
mt_makediff(es,ds)
*/

SpotLess(RadT=3, pel=1, tm=false, blksz=8, chroma=false, thsad=520, dc=pre) #bb0.7
mt_makediff(last, u).invert()

  #trim(7020, 7127)
selectevery(3, 1, 4).selectodd()
#trim(9827, 9912)
#trim(3183, 3491)
#trim(23399, 23446)
#trim(24414, 24586)++trim(24658, 24681)++trim(25222, 25327)
trim(36373, 36637)

last.awarpsharp2(depth=26).NNEDI3CL(1, dh=true, dw=true).SinPowResizeMT(2878,2160)

prefetch(16)

function MMask2(clip C)
{
    ## requires MVTools2
    C ## Last==C
    super = MSuper
    fvec  = MAnalyse(super, isb=false)
    MMask(super, fvec, ml=100, gamma=0.5, 
    \          kind=0, Ysc=0, thSCD1=400, thSCD2=130)
    Grayscale
    Crop(0, 2, C.Width, C.Height, true)
    return Last.Levels(0, 1, 128, 0, 255, coring=false)
}
Edit: I realize now that the descratch part is totally wrong. I forget that I experimented late at night and overwrote the previous script. Sorry

Last edited by anton_foy; 30th November 2023 at 08:10.
anton_foy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:01.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.