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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
User of free A/V tools
Join Date: Jul 2006
Location: SK
Posts: 826
|
How to denoise/despot old cartoon footage?
I've an TV capture from late 80's encoded with Xvid as AVI.
Here is a short sample: http://www.mediafire.com/file/gtzldnmdxjg/sample.avi I don't know how to get rid of all that spots, tried MCTemporalDenoise like this: Code:
# Initialize variable with path to my A/V tools
avdir=GetSystemEnv("PROGRAMFILES")+"\AVTools\"
# Load all the plugins that will be used in the script
Import(avdir + "plugins\MCTemporalDenoise.v1.4.16.avsi") # MCTemporalDenoise (v1.4.16)
LoadPlugin(avdir + "plugins\mvtools2.dll") # MVTools (v2.5.10)
LoadPlugin(avdir + "plugins\mt_masktools-25.dll") # Masktools (v2.0a42)
Import(avdir + "plugins\LSFmod.v1.9.avsi") # LSFmod (v1.9)
LoadPlugin(avdir + "plugins\FFT3DFilter.dll") # FFT3Dfilter (v2.1.1)
LoadPlugin(avdir + "plugins\TTempSmooth.dll") # TTempsmooth (v0.9.4)
LoadPlugin(avdir + "plugins\RemoveGrainSSE2.dll") # Removegrain (v1.0PR)
LoadPlugin(avdir + "plugins\RepairSSE2.dll") # Repair (v1.0PR)
# Deblock (v1.2)
# Deblock_QED (18.aug.2008)
# DctFilter (v0.0.1.4)
LoadPlugin(avdir + "plugins\EEDI2.dll") # EEDI2 (v0.9.2)
LoadPlugin(avdir + "plugins\SangNom.dll") # Sangnom (v1.0beta)
Import(avdir + "plugins\GradFun2DBmod.v1.5.avsi") # GradFun2DBmod (v1.5)
LoadPlugin(avdir + "plugins\gradfun2db.dll") # Gradfun2db (v1.0)
LoadPlugin(avdir + "plugins\AddGrainC.dll") # AddgrainC (v1.4)
# Open source video clip
AVISource("D:\SOURCE\sample.avi",audio=false)
untouched=last
MCTemporalDenoise(settings="high")
StackHorizontal(untouched,last)
![]() Is there any filter available which would erase that kind of noise? I'd noticed that all spots occur just in one frame so I think it could be fairly easy to somehow remove them going by temporal approach, or am I thinking wrong? All other filters that I've tried (UnDot, DeGrainMedian, DeSpot) enable to tune mostly spatial parameters like sizes, thresholds, distances with use of motion compensation but I couldn't get satisfactory results with any of them. Please advice
|
|
|
|
|
|
#5 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
The task of spot removal has not been solved yet. The name of the game is "choose your poison" : There are lots of possibilities to try, but still, there is no solution. You can only choose between different compromises:
a) Less spot removal with only little damage to original content, -or- b) more spot removal with more damage to original content. Choose your poison. I could write you a survey about the plentitude of different problems ... would take me two hours, take up two/three/four pages of text, and at the end the conclusion still would be the same: "no solution, only compromises. Choose your poison." Quick headlines: - no motion compensation: weak approach, in motion areas it's either ineffective or dangerous - with motion compensation: theoretically much better, but ... the spots will mislead the motion engine upon deciding if a compensation is "good" or "bad". The larger the spots, the bigger the problem. - Temporal averaging: in theory it's the "wrong" approach. A spot will get averaged into clean neighbor frames. Also a spot will not be removed, just cut-down in intensity. To be effective, it needs LOTS of temporal neighbors to consider, which in turn is a problem in other aspects. - temporal median: in theory the "method of choice" for spot removal - does clean removal of spots, no spreading into neighbor frames, needs only a small temporal neighborhood. However, IF something goes wrong (from the side of MVTools in the first place), then it will produce artifacts more worse than those of temporal averaging.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#6 | Link |
|
Registered User
Join Date: Jan 2005
Location: cz
Posts: 704
|
has anyone some experience with:
http://spotremoverfilter.com/ |
|
|
|
|
|
#7 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Me not. But if it has to be despite all problems, then a deeper look into kassandro's RemoveDirt is worthwile, and recommended.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#9 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Dunno ... the dup's might help to some extend, but they're not frequent enough that you could rely on them.
For what it's worth, here is a possible primitive for spot removal: Code:
AviSource("D:\sample_spotty.avi")
o=last ox=o.width() oy=o.height()
osup = o.MSuper(pel=2,sharp=2)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4)
bc1 = o.MCompensate(osup,bv1)
fc1 = o.MCompensate(osup,fv1)
Interleave(fc1,o,bc1)
MedianblurT(0,0,0,1) # you can also use "Clense(reduceflicker=false)" instead
SelectEvery(3,1)
StackHorizontal(o,last)
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#10 | Link |
|
User of free A/V tools
Join Date: Jul 2006
Location: SK
Posts: 826
|
Thank you very much Didée, your approach did wonders to my source. I had to replace MedianBlurT with Clense (hopefully you mentioned that as well) because the encoding process kept crashing at the very end. First I thought that it's x264 latest revision to blame (r1613) but the error persisted even with r1538. Once I found the offending part in this filter chain and replaced it the encoding finished always fine.
Here is my complete script, I tried to smooth big uniformly coloured areas (sky, water surface) even more with FFT3DFilter but didn't see any effect really so in the end I left it out completely. Code:
# Open source video clip
AVISource("D:\SOURCE\Family-Ness\Rodina Nessovcov.avi",audio=false).Trim(0,7599)
# Initialize variable with path to my A/V tools
avdir=GetSystemEnv("PROGRAMFILES")+"\AVTools\"
# Load all the plugins that will be used in the script
LoadPlugin(avdir + "plugins\mvtools2.dll") # MVTools (v2.5.10)
#~ LoadPlugin(avdir + "plugins\FFT3DFilter.dll") # FFT3Dfilter (v2.1.1)
LoadPlugin(avdir + "plugins\aWarpSharp.dll") # aWarpSharp (2009.06.19)
#~ LoadPlugin(avdir + "plugins\medianblur.dll") # MedianBlur (v0.84)
LoadPlugin(avdir + "plugins\DePan.dll") # DePan (v1.10.1)
LoadPlugin(avdir + "plugins\DePanEstimate.dll") # DePanEstimate (v1.9.2)
LoadPlugin(avdir + "plugins\RepairSSE2.dll") # Repair (v1.0PR)
LoadPlugin(avdir + "plugins\RemoveGrainSSE2.dll") # RemoveGrain (v1.0PR)
LoadPlugin(avdir + "plugins\RemoveGrainTSSE2.dll") # RemoveGrainT (v1.0PR)
Import(avdir + "plugins\Stab.avsi") # Stabilize script (v1.0)
# remove single-frame spots
o=last
osup = o.MSuper(pel=2,sharp=2)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4)
bc1 = o.MCompensate(osup,bv1)
fc1 = o.MCompensate(osup,fv1)
Interleave(fc1,o,bc1)
#~ MedianblurT(0,0,0,1) # you can also use "Clense(reduceflicker=false)" instead
Clense()
SelectEvery(3,1)
# stabilize subtle shaking of whole image
Stab(8,10,10)
# crop and resize
Crop(8,2,-0,-0).Spline36Resize(640,480)
#~ FFT3DFilter(plane=3, bt=3, sigma=3, bw=16, bh=16, ow=8, oh=8) # denoise chroma
aWarpSharp2(thresh=160, blur=3, type=0, depth=16, chroma=4) # sharpen the image, make it crisp and less blurry
#~ StackHorizontal(o,last)
|
|
|
|
|
|
#11 | Link | |
|
User of free A/V tools
Join Date: Jul 2006
Location: SK
Posts: 826
|
Quote:
Author's example screens looked promising though
|
|
|
|
|
|
|
#12 | Link |
|
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 761
|
KillerSpots
I have made Didée's idea to remove spots:
Code:
# Function KillerSpots 3.1
# For primitive videos (live action/animation)
# Function for spot removal
# Original idea by Didée (https://forum.doom9.org/showthread.php?p=1402690#post1402690)
# Developed by GMJCZP
# With adaptation of johnmeyer's revision of RemoveDirt function
# (See RemoveDirt documentation and Film restoration script by videoFred)
# Requirements: MVTools, RGTools, RemoveDirt
Function KillerSpots(clip o, int "limit", bool "advanced",bool "anim", int "repmode", bool "comp")
{
advanced = Default(advanced, true) # best performance, otherwise is the original Didée's idea (for live action is better)
comp = Default(comp, false) # for compare results
# Options for advanced = true:
limit = Default(limit, 10) # spot removal limit. Higher values, more killing spots but can hurt details
anim = Default(anim, true) # for animated content, otherwise is live action
repmode = Default(repmode, 2) # repair mode for preserve details: repmode=1 for classic Repair, repmode=2 for temporal repair
# Temporal repair is more safe (limit values can be more highs) but more spots can reappear
Assert((repmode == 1 || repmode == 2), "repmode error, values of 1 or 2 are only admitted")
# Didée's idea (if advanced=false, with direct Clense method for killing spots)
osup = o.MSuper(pel=2,sharp=2)
bv1 = osup.MAnalyse(isb=true, delta=1,blksize=8,overlap=4,search=4)
fv1 = osup.MAnalyse(isb=false,delta=1,blksize=8,overlap=4,search=4)
bc1 = o.MCompensate(osup,bv1)
fc1 = o.MCompensate(osup,fv1)
Interleave(fc1,o,bc1)
advanced ? RemoveDirtMod(limit,anim,repmode) : Clense()
SelectEvery(3,1)
comp ? StackHorizontal(o,last) : last
}
# From function RemoveDirt, original adaptation thanks to johnmeyer
Function RemoveDirtMod(clip input, int "limit", bool "anim", int "repmode")
{
d = anim ? 1 : 3
dm = anim ? 1 : 2
pt = anim ? 4 : 6
ct = anim ? 6 : 8
clensed = input.Clense()
alt = input.RemoveGrain(dm)
restore = (repmode==2) ? TemporalRepair(clensed, input, mode=4) : Repair(clensed, input, mode=16)
return RestoreMotionBlocks(clensed,restore,alternative=alt,neighbour=input,pthreshold=pt,cthreshold=ct, gmthreshold=40,
\ dist=d,dmode=dm,debug=false,noise=limit,noisy=12)
}
Last edited by GMJCZP; 24th December 2021 at 13:18. Reason: Update to version 3.1 (added anim and repmode) |
|
|
|
|
|
#13 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
It seems to work well. Thanks a lot. Might I suggest a name change? When I'm looking to use a spot remover and I'm going down my list of functions. 'Primitive' just doesn't jump out as a spot remover. Since 'RemoveSpots' and 'RemoveDirt' are already taken, then how about 'SpotRemover'? Or maybe you can suggest a different but still relevant name? CrudBeGone. SpotEx. CleanUp. DirtClean. Your choice.
![]() Yeah, I know. I can just change it myself. But it's your filter (and Didée's). Last edited by manono; 26th July 2017 at 08:51. |
|
|
|
|
|
#14 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,411
|
Just had something jump into my head, hows bout "SpotLess()" ?
![]() EDIT: From my pop-up dictionary, "Completely neat and clean".
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th July 2017 at 12:31. |
|
|
|
|
|
#15 | Link | |
|
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 761
|
Quote:
manono, I named it because Didée used that expression and I wanted to respect it, in addition the "primitive" videos have these characteristics. Let's do one thing, I'll modify the name for another one I had already thought of, but in the description I'll put some of this, lol. PD: TinMan, I hope this function is always SpotLess ;-) Last edited by GMJCZP; 26th July 2017 at 13:26. |
|
|
|
|
|
|
#20 | Link |
|
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 761
|
Now to the function KillerSpots I have added a "advanced" mode, which produces better performance (at least I noticed in a test video) and also makes the function more configurable when defining a "limit" parameter, which by the way Is totally equivalent to the parameter present in the RemoveDirtMC function developed by johnmeyer.
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|