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

 

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

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd March 2006, 23:22   #181  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 722
Strange...I was just watching ""The Fearless Vampire Killers on DVD and a few minutes after I read this topic

I would really like to know what script you applied on these pics, it looks almost too good to be true. Im having the same noise/grain pattern in my footage so I would like to try that.

Thanks!
anton_foy is offline   Reply With Quote
Old 3rd March 2006, 02:20   #182  |  Link
Heini011
Registered User
 
Join Date: Nov 2003
Posts: 148
Hi anton_foy,

give this hq_filter a try, it is still a bit better ;-)

Code:
function RemoveTempGrain(clip input, int _mode)
{
  rg = RemoveGrain(input, mode=_mode)
  return TemporalRepair(rg, input)
}

function RemoveDirt(clip input, int limit, bool "_grey")
{
  _grey=default(_grey, false)
  clensed=input.Clense(grey=_grey, cache=4)
  alt=input.RemoveGrain(2)
  return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=16,grey=_grey)
}

function SRemoveDirtMC(clip,int limit, bool "_grey")
{
  _grey=default(_grey, false)
  limit = default(limit,6)
  bvec = clip.MVAnalyse(isb=false, blksize=8, delta=1, pel=2, truemotion=true, idx=1)
  fvec = clip.MVAnalyse(isb=true, blksize=8, delta=1, pel=2, truemotion=true, idx=1)
  backw = clip.MVFlow(bvec)
  forw  = clip.MVFlow(fvec)
  clp=interleave(backw,clip,forw)
  clp=clp.RemoveDirt(limit,_grey)
  dnc=clp.RemoveTempGrain(1)
  clp=clp.SelectEvery(3,1)
  dnc=dnc.SelectEvery(3,1)
  clp=clp.SeeSaw(dnc,Sstr=0.26,Szp=12,SdampHi=20,bias=40)
  return clp
}


function hq_filter(clip c)
{
  c=c.SRemoveDirtMC(6)
  c=c.YlevelsS(0,1.05,255,0,255)
  c=c.LimitedSharpenFaster(Smode=4,strength=18,overshoot=1,wide=false)
  return c
}
Heini011 is offline   Reply With Quote
Old 21st March 2006, 11:33   #183  |  Link
SBaT
Registered User
 
Join Date: Jun 2005
Posts: 22
Thankyou for the nice script example, really usefull when I'm trying to grasp the use of MvTools and RemoveDirt with avs. However I'm quite confused atm after reading the end of RemoDirt manual as far if croping should be done before or after with a script like yours. As I'm encoding my 1080i.ts to 720p I have to crop atleast 2, 0, -4, -8 to get rid of black sides.
SBaT is offline   Reply With Quote
Old 12th September 2006, 03:06   #184  |  Link
canuckerfan
Registered User
 
Join Date: Jul 2005
Posts: 317
Heini011, will your script wortk with mvtools 1.4.11?
canuckerfan is offline   Reply With Quote
Old 7th November 2006, 05:44   #185  |  Link
superuser
Registered User
 
Join Date: Sep 2006
Posts: 84
Edited

Last edited by superuser; 12th November 2006 at 22:30.
superuser is offline   Reply With Quote
Old 6th April 2007, 17:24   #186  |  Link
dnaxx
Registered User
 
Join Date: Dec 2003
Posts: 4
problem

Heini011, thanks for the script. But I don't get it running because "SeeSaw" is missing. Can you help me please?
dnaxx is offline   Reply With Quote
Old 6th April 2007, 17:56   #187  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,836
Why not use the search, it would give you the answer in no time.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 14th November 2008, 17:35   #188  |  Link
rkalwaitis
Robert
 
Join Date: Jan 2008
Location: Stuttgart
Posts: 407
Anyone a simple question.

So this script

function RemoveTempGrain(clip input, int _mode)
{
rg = RemoveGrain(input, mode=_mode)
return TemporalRepair(rg, input)
}

function RemoveDirt(clip input, int limit, bool "_grey")
{
_grey=default(_grey, false)
clensed=input.Clense(grey=_grey, cache=4)
alt=input.RemoveGrain(2)
return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=16,grey=_grey)
}

function SRemoveDirtMC(clip,int limit, bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)
bvec = clip.MVAnalyse(isb=false, blksize=8, delta=1, pel=2, truemotion=true, idx=1)
fvec = clip.MVAnalyse(isb=true, blksize=8, delta=1, pel=2, truemotion=true, idx=1)
backw = clip.MVFlow(bvec)
forw = clip.MVFlow(fvec)
clp=interleave(backw,clip,forw)
clp=clp.RemoveDirt(limit,_grey)
dnc=clp.RemoveTempGrain(1)
clp=clp.SelectEvery(3,1)
dnc=dnc.SelectEvery(3,1)
clp=clp.SeeSaw(dnc,Sstr=0.26,Szp=12,SdampHi=20,bias=40)
return clp
}

function RMBDenoise(clip input, bool "_grey", int "repmode")
{
clmode=17
clensed=Clense(input, grey=_grey)
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode )
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, neighbour2=clensed, gmthreshold=70, dist=0, debug=true, noise=12, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode )
}

function hq_filter(clip c)
{
c=c.SRemoveDirtMC(6)
c=c.YlevelsS(0,1.05,255,0,255)
c=c.LimitedSharpenFaster(Smode=4,strength=18,overshoot=1,wide=false)
return c
}

and the one above are simple place as they are into the avs file? Correct? Of course I have to have the appropriate plugins.
rkalwaitis is offline   Reply With Quote
Old 17th November 2008, 04:03   #189  |  Link
R3Z
Silver Über Alles
 
R3Z's Avatar
 
Join Date: Aug 2006
Location: Australia
Posts: 269
Quote:
Originally Posted by rkalwaitis View Post
Anyone a simple question.

and the one above are simple place as they are into the avs file? Correct? Of course I have to have the appropriate plugins.

It will work that way and you can rename the .avs file to .avsi and it will autoload into memory without being needed to be Loaded manually.
R3Z is offline   Reply With Quote
Old 17th November 2008, 07:51   #190  |  Link
rkalwaitis
Robert
 
Join Date: Jan 2008
Location: Stuttgart
Posts: 407
R3Z

So I import the avsi file that I made. How do I call the function to do the work . RemoveDirt()? Like this?
rkalwaitis is offline   Reply With Quote
Old 17th November 2008, 19:52   #191  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,754
Quote:
So I import the avsi file that I made.
What do you mean? The whole point of the avsi file is that you just drop it into your plugins directory and you don't have to import anything.

Basically, save those functions above in a text file with ".avsi" as the extension. Drag this to your Avisynth plugins folder.

If you ever want to use those functions, just add something like "hq_filter()" or "RMBDenoise(_grey=false)" to the script that you are currently working on.

There is no need to import anything, you just call the functions like you would any normal plugin.
Adub is offline   Reply With Quote
Old 18th November 2008, 19:33   #192  |  Link
rkalwaitis
Robert
 
Join Date: Jan 2008
Location: Stuttgart
Posts: 407
Merlin,

Thanks, that is what I meant. Now I get it. Thanks again.
rkalwaitis is offline   Reply With Quote
Old 28th June 2009, 01:14   #193  |  Link
Lyris
Registered User
 
Join Date: Sep 2007
Location: Europe
Posts: 602
Heini011: thank you so much for this function. The accuracy is INCREDIBLE compared to other dirt and scratch removal plugins I've used!

The only issue I'm having is that it's difficult to keep film grain AND get rid of the dirt/scratches. I've resorted to degraining, using your function, and then re-graining the output to keep the original look.

Once again, thank you.
Lyris is offline   Reply With Quote
Old 18th September 2009, 19:27   #194  |  Link
turnipzoink
Registered User
 
Join Date: Dec 2008
Posts: 13
Damn I'm jealous.
This is the only plugin I can't get to work? I tried email the author at gmx.de, not replying.

I tried each dll and none of them work. Avisynth is obviously loading them, but can't find the function. What am I doing wrong?

9-18-2009 8-23-52 PM.png
turnipzoink is offline   Reply With Quote
Old 21st September 2009, 08:03   #195  |  Link
videoFred
Registered User
 
videoFred's Avatar
 
Join Date: Dec 2004
Location: Terneuzen, Zeeland, the Netherlands, Europe, Earth, Milky Way,Universe
Posts: 693
Quote:
Originally Posted by turnipzoink View Post
I tried each dll and none of them work. Avisynth is obviously loading them, but can't find the function. What am I doing wrong?
If you are using the Heini011 function, you must use HQ_filter() instead of RemoveDirt().

Off cource all dll's must be there, and Heini's function also.

PS: you need RemoveDirt.avs too.

Fred.
__________________
About 8mm film:
http://www.super-8.be
Film Transfer Tutorial and example clips:
https://www.youtube.com/watch?v=W4QBsWXKuV8
More Example clips:
http://www.vimeo.com/user678523/videos/sort:newest

Last edited by videoFred; 21st September 2009 at 08:12.
videoFred is offline   Reply With Quote
Old 1st November 2009, 14:54   #196  |  Link
Paazabel
Registered User
 
Join Date: Nov 2004
Location: St. Louis
Posts: 42
To the author: Thanks for this filter. I tried a bunch of different stuff that did not work on this clip. I'm sure many people have used it, but I wanted to make sure you got a "thanks" from me.

Sampling, stacked before-and-after (Lagarith, YV12, ~100M): http://www.sgt.cc/vid/Less-spotty.avi

(side note: Software rights can be a pain in the backside; would be nice if a great script could be "packaged" with all the other plugins that make it work. I know, I'm just lazy, but I spent about 2 hours debugging differences in plugin versions. It was worth it, but for an AVIsynth newb, it would have been improbable for them to stick with it.)

Sample frames:
I was particularly impressed with the second one since there are "real" dark spots in that frame and nothing else came remotely close to finding them. The first frame shows smoke rising over the hill which is in each frame and not processed as "noise." Very cool.




Not as interesting, but ... getting my money's worth out of the ol' computer!

Paazabel is offline   Reply With Quote
Old 7th November 2009, 00:57   #197  |  Link
Lyris
Registered User
 
Join Date: Sep 2007
Location: Europe
Posts: 602
Question: is it possible to limit RemoveDirt to be colour-specific? That is, to only have it detect black (or nearly black) and white (or nearly white) areas as spots? It would improve accuracy...
Lyris is offline   Reply With Quote
Old 7th November 2009, 09:09   #198  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Lyris View Post
Question: is it possible to limit RemoveDirt to be colour-specific? That is, to only have it detect black (or nearly black) and white (or nearly white) areas as spots? It would improve accuracy...
Yes it is possible, without testing:

Code:
source   = last
filtered = source.RemoveDirt()

dark   = 32
bright = 196
mask   = mt_lut(source,"x "+string(dark)+" < 255 x "+string(bright)+" > 255 0 ? ?",U=1,V=1).removegrain(19,-1,-1)

mt_merge(source,filtered,mask,luma=true)
Adjust dark (0 = do nothing in black areas) & bright (255 = do nothing in bright areas) to your taste...


Another way is to limit RemoveDirt where changes are really big:

Code:
source   = last
filtered = source.RemoveDirt()

min  = 16
max  = 255
mask = mt_lutxy(source,filtered,"x y - abs "+string(min)+" < 0 x y - abs "+string(max)+" > 0 255 ? ?",U=1,V=1).removegrain(19,-1,-1)

mt_merge(source,filtered,mask,luma=true)
"min" is the minimum required and "max" is the maximum allowed


If you want to merge the two method:
Code:
source   = last
filtered = source.RemoveDirt()

dark   = 32
bright = 196
mask1  = mt_lut(source,"x "+string(dark)+" < 255 x "+string(bright)+" > 255 0 ? ?",U=1,V=1).removegrain(19,-1,-1)

min   = 16
max   = 255
mask2 = mt_lutxy(source,filtered,"x y - abs "+string(min)+" < 0 x y - abs "+string(max)+" > 0 255 ? ?",U=1,V=1).removegrain(19,-1,-1)

mt_merge(source,filtered,mt_logic(mask1,mask2,"min"),luma=true)
This one should be the best after tweaking the 4 parameters

Last edited by LaTo; 7th November 2009 at 09:39.
LaTo is offline   Reply With Quote
Old 7th November 2009, 17:48   #199  |  Link
Paazabel
Registered User
 
Join Date: Nov 2004
Location: St. Louis
Posts: 42
Given the temporal nature of the filter (comparing one frame vs another), I'm not sure this would "improve performance" on most dirt. The comparison is the same frame-by-frame and it even removes blue dirt, from what I can tell, as well as grain and noise that are not near those thresholds.

Which is to say - academically, yes, I think you can do that, but I'm not sure it will have any meaningful "improvement" in either accuracy or speed.
Paazabel is offline   Reply With Quote
Old 8th November 2009, 14:50   #200  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Paazabel View Post
Given the temporal nature of the filter (comparing one frame vs another), I'm not sure this would "improve performance" on most dirt. The comparison is the same frame-by-frame and it even removes blue dirt, from what I can tell, as well as grain and noise that are not near those thresholds.

Which is to say - academically, yes, I think you can do that, but I'm not sure it will have any meaningful "improvement" in either accuracy or speed.
Hum, your method remove spots... but also grain & details : oversmoothed effect! (artificial look)
It isn't really good to me

Some screenshots of my purpose:

Screenshot 1:

Original frame
The filtered clip (Your)
The code above (Mine)


Screenshot 2:

Original frame
The filtered clip (Your)
The code above (Mine)


The code:
Code:
DirectShowSource("Less-spotty.avi")
ConvertToYV12()

source   = last.crop(0,0,-720,0)
filtered = last.crop(720,0,0,0)

str = 20

mt_merge(source,filtered,mt_lutxy(source,filtered,"x y - abs "+string(str)+" *",U=1,V=1).mt_expand(U=1,V=1).removegrain(19,-1,-1),luma=true,U=3,V=3)
str=20 give very good result...

No spot, but still detailled


After, you can use a more robust denoiser to remove the little noise while preserving details:

Code:
MCTemporalDenoise(chroma=true,flat=true,stabilize=true,sigma=2,strength=200,Tovershoot=2)
Screenshot 1 & Screenshot 2


So, in conclusion, compare:
Before (your) - After (mine)
Before (your) - After (mine)

The choice is easy
LaTo 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 04:34.


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