View Full Version : New halo removers discussion
Didée
2nd November 2005, 15:43
The present haloing knocked me off the chair!
... But when hitting the ground, I had a raw idea worth to try:
rad = 3.0 # radius for halo removal
ss = 1.5 # radius for supersampling / ss=1.0 -> no supersampling
o = last
ox = o.width()
oy = o.height()
x = o.bicubicresize(m4(ox/rad),m4(oy/rad)).bicubicresize(ox,oy,1,0)
y = yv12lutxy(o,x,"x 8 + y < x 8 + x 24 - y > x 24 - y ? ? x y - abs * x 32 x y - abs - * + 32 /",U=2,V=2)
z1 = repair(o,y,1)
maxbig = y.expand().bicubicresize(m4(ox*ss),m4(oy*ss))
minbig = y.inpand().bicubicresize(m4(ox*ss),m4(oy*ss))
z2 = o.lanczosresize(m4(ox*ss),m4(oy*ss))
z2 = z2.logic(maxbig,"min",U=2,V=2).logic(minbig,"max",U=2,V=2).lanczosresize(ox,oy)
(ss == 1.0) ? z1 : z2
return last
#----------
function m4(float x) {return( x<16?16:int(round(x/4.0)*4)) }
No tweaks (could be done), no safety checks about ranges & so (probably needed), just your source image with raw halo press-down:
http://img157.imageshack.us/img157/9903/fuframe2904sourcedehalo0wt.png (http://imageshack.us)
Chainmax
2nd November 2005, 16:39
I don't see that much haloing in the source frame (probably because it's so messy, I can provide cleaner frames with halos if you want) but I'm going to try it, thanks :).
[edit]Could you arrange it into a function? I don't know how to include it on the script.
yaz
2nd November 2005, 16:43
vouw ... nother impressive script from didée :)
what i can't get :
- what is z1 ? ( i guess, it's the 'repaired' clip )
- why is 1.5 is hardcoded in the supersampling part ( i guess, that'd be ss instead )
... or am i on a wrong way ?
thx
y
Didée
2nd November 2005, 16:54
- what is z1 ...
- why is ...
Dunno. Falling from the chair, I landed on my head ... straight thinking impossible.
Hey, it's just a sudden glance, quickly scribbled, and seems to do [at least] something right. I almost assure you there'll be some overflow-errors in the LUT ... can't evaluate that now.
For Chainmax:
function abcxyz(clip clp, int "rad", int "ss")
{
rad = default(rad, 3.0) # radius for halo removal
ss = default(ss, 1.5) # radius for supersampling / ss=1.0 -> no supersampling
ox = clp.width()
oy = clp.height()
x = clp.bicubicresize(m4(ox/rad),m4(oy/rad)).bicubicresize(ox,oy,1,0)
y = yv12lutxy(clp,x,"x 8 + y < x 8 + x 24 - y > x 24 - y ? ? x y - abs * x 32 x y - abs - * + 32 /",U=2,V=2)
z1 = repair(clp,y,1)
maxbig = y.expand().bicubicresize(m4(ox*ss),m4(oy*ss))
minbig = y.inpand().bicubicresize(m4(ox*ss),m4(oy*ss))
z2 = clp.lanczosresize(m4(ox*ss),m4(oy*ss))
z2 = z2.logic(maxbig,"min",U=2,V=2).logic(minbig,"max",U=2,V=2).lanczosresize(ox,oy)
return( (ss==1.0) ? z1 : z2 )
}
function m4(float x) {return( x<16?16:int(round(x/4.0)*4)) }
Obviously and as usual, RemoveGrain/Repair and MaskTools are needed.
FredThompson
2nd November 2005, 17:19
Just for snicks and grins, look at the first post in this thread and see if enlarging, then noise filtering (maybe even a little heavier), then shrinking, then LimitedSharpen will help. http://forum.doom9.org/showthread.php?s=&threadid=68494 The sample images are gone but the results was wonderful. Maybe, just maybe, this would make the aberrations more aberrant...
FWIW, some folks combat that horrible blockiness in very similar areas by playback with ffdshow and adding a little noise. It can help break up the outlines just enough to fool our eyes during playback.
edit: Hah! I knew all this seemed too familiar: http://forum.doom9.org/showthread.php?s=&threadid=64432
AVIL
2nd November 2005, 21:12
@Chainmax
AVIL: I used FFT3DFilter at sigma=6 and bt=3 (alone and with TemporalSoften) but it didn't do much to the rainbows.
Try with a script like :
avisource("your.avi")
fft3dfilter(sigma=3,sigma2=3,sigma3=12,sigma4=3,bt=3,plane=1)
fft3dfilter(sigma=3,sigma2=3,sigma3=12,sigma4=3,bt=3,plane=2)
In my case the rainbows are middle-sized so I use heavy denoising en sigma3. Real colour are more afected by sigma4, then I use a moderate value for it. Sigma and sigma2 copes whit subtle rainbows. You can raise this values but in the first example I think it isn't necessary.
Anyway, bifrost and smartssiq are very effective filters. In fact you can combine it:
From bifrost's manual.
Bifrost(scenelumathresh=1.5,altclip=SSIQ(11,100,true),interlaced=true)
But i found fft3dfilter more suited for me, in part for YUY2 support, in part for the easy in tunning the filter.
Chainmax
3rd November 2005, 01:59
Didée, you are THE MAN!!! By replacing the FFT3DFilter line with a default call to abcxyz, the halos are completely gone and the result is almost identical to the last screen I posted!! :):). I'll post the three screens with this filterchain soon.
FredThompson
3rd November 2005, 02:56
Didée does make some really good cleaning stuff. There are those, however, who think he's a shill for CPU manufacturers :P
Methinks I'll try this on some DV moire (camcorder shots of moving roller conveyor) and see how it does. Maybe it will also help with laserdisc moire.
Chainmax
3rd November 2005, 22:38
Here are the three screens with the last filterchain:
http://img26.imageshack.us/img26/4499/finalscriptresult18rg.png (http://imageshack.us)
[link removed, screenshot appears now on page 3]
http://img470.imageshack.us/img470/7316/finalscriptresult34xt.png (http://imageshack.us)
The first one looks pretty much the same as the last attempt, but the second and third one look worse. They are, however, rare special cases that will probably be attenuated(sp?) by x264's deblocking (0,0 has proven too weak so I'll go for 2,2) anyway. I will encode a sample in a taxing sequence and upload it for you guys to examine. Again, thanks for all the input :).
FredThompson
3rd November 2005, 22:51
You could play with MDeblock http://www.mdeblock.de.tf/
I like the results of LimitedSharpen but it's dog slow. The basic idea, modifying the extremes of the sharpening, could be put into dll sharpeners and they'd probalby run a lot faster. My Athlon XP 2200s run HC best profile at 5 fps with LimitedSharpen, ~30 fps without it. Something to keep in mind because it dramatically impacts encoding time.
Chainmax
3rd November 2005, 23:30
Since these are 25min episodes, I can just compress to ffdshow's YV12 huffyuv and then feed that into MeGUI. I'll try MDeblock soon and report back, although it kinda bugs me that it never was developed over v0.3 and that it went pretty much unnoticed here.
Didée
4th November 2005, 08:56
@ Fred
Get this (http://forum.doom9.org/showthread.php?t=99679) and this (http://forum.doom9.org/showthread.php?p=731909#post731909), try Soothe(LimitedSharpen(ss_x=1.0,ss_y=1.0,Smode=4),last,24) [or 16], and compare again fps and result.
FredThompson
4th November 2005, 10:46
I'm now seeing 10 fps instead of 5 and the oversharp whities are reduced without losing the sharpness of the black lines. Thanks. DVD-RB Pro is now an overnight task, not a "sometime tomorrow" task. Thanks!!
What is the last parameter? I used your first suggestion, not the second. This is some sort of influence limiter?
The thread for Soothe mentioned the possibility of support files for LimitedSharpen. I wonder if anyone other than hanc messes with Fortran. Seems like a natural way to get some speed in the math routines.
Tried UnSharpMask instead of LimitedSharpen but the results just weren't that great. LimitedSharpen seems to do a very nice job of sharpening hard edges and leaving relatively smooth areas less modified. Quite helpful for animation, especially with the relatively low amount of oversharp artifacts.
Chainmax
5th November 2005, 12:52
I made a test encode of an expecially taxing sequence. You can download it from [link deleted].
Anonymouses
10th November 2005, 05:41
I'd just like to throw in that the dehaloing script you wrote Didée is pretty nice. Gets rid of the halos as good as BlindDeHalo but doesn't make the video blurry and doesn't thin out black lines.
Source:
http://img174.imageshack.us/img174/5405/source1qq.png
Using abcxyz():
http://img174.imageshack.us/img174/3412/abcxyz5jv.png
Using BlindDeHalo2(2.5,2.5,160):
http://img174.imageshack.us/img174/6596/blinddehalo22uh.png
And thanks for pointing out BiFrost Chainmax as it is a nice rainbow filter.
With BiFrost and abcxyz():
http://img174.imageshack.us/img174/1708/bifrost8pa.png
Anonymouses
10th November 2005, 07:23
I don't want to get too off topic here, but I can't get over how nice that dehalo script is. Here's another couple of samples comparing it against BlindDeHalo2 which I used to use. I changed the rad so that it takes float values.
Source:
http://img477.imageshack.us/img477/1320/sourcelupin2rc.png
default abcxyz():
http://img477.imageshack.us/img477/1926/abcxyzlupin7ry.png
abcxyz(rad=1.75), turned down the radius to preserve the small bright areas, and HQDering(255) to catch the bit of ringing that the lowered radius doesn't get:
http://img477.imageshack.us/img477/7838/abcxyzrad175lupin1ll.png
BlindDeHalo2(2.5,2.5,160):
http://img477.imageshack.us/img477/9868/blinddehalo2lupin2io.png
Chainmax
10th November 2005, 11:50
Very nice indeed. I'm going to test abcxyz (I renamed it to DDeHalo, i.é: Didée's DeHalo :)) on my test source that has lost of small details and see how it compares to HQDering, FixVHSOverSharp and BlindDeHalo3.
Anonymouses, I recently made a separate thread wher I ask for feedback on my Trigun encoding attempts. I'm mulling over two alternatives and would appreciate your feedback.
Anonymouses
10th November 2005, 12:08
Very nice indeed. I'm going to test abcxyz (I renamed it to DDeHalo, i.é: Didée's DeHalo :)) on my test source that has lost of small details and see how it compares to HQDering, FixVHSOverSharp and BlindDeHalo3.
Well at least in my tests I like to use both the dehaloer, with the radius turned down from default to stop it from messing with small bright areas, and using HQDering to pick up the haloing that is left behind due to the smaller radius. Though even at lower radiuses does get rid of more of the halo then just HQDering alone even when its set to 255.
Anonymouses
10th November 2005, 12:39
Chainmax just curious, how bad is the blocking on the R1 discs or is it pretty isolated? Looking at some of those shots with the pretty bad blocking and having seen how bad the rainbows are on the R1 discs, I'm glad that I bought the R3 boxset.
Chainmax
11th November 2005, 01:06
It's pretty nasty, but it is isolated too :p. It appears mostly on Vash's costume and a few rare times in sky scenes as well. I can upload a vob sample with the intro if you want to check it out.
Anonymouses
11th November 2005, 02:58
It's pretty nasty, but it is isolated too :p. It appears mostly on Vash's costume and a few rare times in sky scenes as well. I can upload a vob sample with the intro if you want to check it out.
Okay, I'm just curious to see how bad it really is. Though I think between the blocking and the rainbowing, that the rainbowing would probably more distracting from the screenshots I've seen.
Chainmax
11th November 2005, 03:01
Now that I look at the intro frame with the last filterchain, the white letters do look duller and yellowish. I'll try lowering DDeHalo's (the name I invented for abcxyz) radius to see if that makes them look better.
Anonymouses
11th November 2005, 03:03
Now that I look at the intro frame with the last filterchain, the white letters do look duller and yellowish. I'll try lowering DDeHalo's (the name I invented for abcxyz) radius to see if that makes them look better.
Yeah, I've noticed that lowering it to between 1.75 or 2.00 with HQDering picking up the slack looks better. Doesn't make the bright spots as greyish, and still does a good job of getting rid of the halos. Especially noticeable in the Castle of Cagliostro shots if you look at the chandelier.
Chainmax
11th November 2005, 03:12
Castle of Cogliostro? :confused:
Is that where the screens you posted in the 2nd page come from?
Anonymouses
11th November 2005, 03:50
Castle of Cogliostro? :confused:
Is that where the screens you posted in the 2nd page come from?
Yeah. Are you saying you've never heard of Castle of Cagliostro? http://www.iidb.org/vbb/images/smilies/eeka.gif
Chainmax
11th November 2005, 03:59
I am merely an ignorant newbie in the anime world. So far I've only seen (and sometimes not all of) DB, DBZ, Grave of the fireflies, Captain Tsubasa, Trigun, Saikano, Evangelion, Astroboy (80s methinks), Rurouni Kenshin, Spirited Away, Saint Seiya and a few others I can't remember right now. :o++
Anonymouses
11th November 2005, 04:00
I am merely an ignorant newbie in the anime world. So far I've only seen (and sometimes not all of) DB, DBZ, Grave of the fireflies, Captain Tsubasa, Trigun, Saikano, Evangelion, Astroboy (80s methinks), Rurouni Kenshin, Spirited Away, Saint Seiya and a few others I can't remember right now. :o++
Ahh you should definitely see it. It's one of Hayao Miyazaki's first films as director.
Chainmax
11th November 2005, 04:02
Let's discuss this further via PM :).
Chainmax
11th November 2005, 22:00
How could you set rad to 1.75? Its type is set to int, I had to switch it to float in order to be able to do that. By the way, 1.75 would be a much better default value, maybe toying with ss using HQDering as fallback could be avoided, can you please test that?
Anonymouses
13th November 2005, 09:28
How could you set rad to 1.75? Its type is set to int, I had to switch it to float in order to be able to do that.
Yeah, that's what I did. To quote myself:
I changed the rad so that it takes float values.
:)
By the way, 1.75 would be a much better default value, maybe toying with ss using HQDering as fallback could be avoided, can you please test that?
Sure, I can do that.
Edit: Messing around with the ss doesn't do anything. :(
Anonymouses
13th November 2005, 09:46
Actually been messing around with the radius again and I'm starting to like it around 2.25, a good balance IMO between halo removal and preserving the bright areas, and no need for HQDering. Heres some comparisons:
Source:
http://img476.imageshack.us/img476/5783/source3aa.png
Radius 3.00:
http://img476.imageshack.us/img476/4950/rad3001ou.png
Radius 1.75:
http://img476.imageshack.us/img476/7494/rad1754ob.png
Radius 2.25:
http://img476.imageshack.us/img476/9116/rad2256ds.png
Source:
http://img476.imageshack.us/img476/7011/sourcea4pm.png
Radius 3.00:
http://img476.imageshack.us/img476/696/rad300a4vv.png
Radius 1.75:
http://img476.imageshack.us/img476/613/rad175a2tu.png
Radius 2.25:
http://img476.imageshack.us/img476/7140/rad225a8ld.png
Didée
13th November 2005, 14:37
Guys. It's a trick function, aiming at removing brighties and preserving darkies. Reducing radius to preserve the brighties will also weaken the removal effekt - note that in your r=2.25 examples the halos are only damped, but not removed. While in the last shot, the letters still are noticeably darkened.
There were good reasons why initially I only posted a linear script, not a function ... and later named the function begged for as silly as "abcxyz": While it might have some potential, still it's only a trick function that *must* fail in places.
BTW, there was quite some mentioning of BlindDeHalo2 in this thread. Did anyone notice that BlindDeHalo has reached its 3rd incarnation since quite some time, and has gotten lots of tweaks to play with?
- "sharpness" parameter (and "tweak" counterpart)
- "lodamp" (and "hidamp" (!) ) parameter
- the "PP" modes, which act somewhat similar to HQdering ...
-- ... where "PP" < 0 runs *only* these routines, without the main dehaloing one
(a quickly fiddled before (http://img382.imageshack.us/img382/6382/vorher2uf.jpg) / after (http://img382.imageshack.us/img382/5219/nachher9ft.jpg) example, posted on the German forum some months ago.)
Know your tools. ;)
Chainmax
14th November 2005, 02:08
It might be a trick function, but it works wonderfully, and following rad=1.75 with HQDering is still a great option. Just because some people diss your awesome work that doesn't mean you must do it yourself. I really do believe that DDeHalo deserves its own thread and more testing by various persons.
About BDH3, I didn't mention it because I figured Anonymouses preferred 2 to 3. Besides, I just don't like the BDH line, I feel they oversmooth the whole frame and kill tiny details.
Anonymouses
14th November 2005, 03:03
Yeah but BlindDeHalo, even the 3rd incarnation, has a real problem with destroying black lines while this preserves them which is one things I like about it. Maybe something could be added to help preserve the black lines without needing to redarken them after using BDH? And true, while using a radius under 3.00 doesn't completely eliminate the halos it does dampen them enough that something like HQDering can be used to eliminate the last bit without hurting more of the bright areas and preserving the integrity of the black lines.
yaz
14th November 2005, 13:28
Guys. It's a trick function ... it might have some potential, still it's only a trick function that *must* fail in places ...yep yep ... make some tuning here and there and finally u get ... BDH ;) anyway. if u think of polishing abcxyz consider to move your resizing into the very last step a/o using spline16resize instead of lanczos. it'll fasten the encoding and decrease halo, definitely.
the bests
y
Didée
14th November 2005, 13:48
Oh, I think the resizing is already put as late as possible. And are you sure that spline16resize is faster and/or does create less ringing than lanczosresize?
No matter ... if I'd [manage to] put in the stuff exactly as you all would like, the speed would get very very slow anyway. We're probably talking about utilising median filtering with bigger radii, and such stuff. :)
yaz
14th November 2005, 16:37
@didée
i didn't mean u w/my comments but the abcxyz addicts :)
as regards spline16, yes, it produces much less ringing. speed? dunno. more or less the same. worth to give it a go.
what i meant by 'moving resizing in' is quite simple. chainmax's script contains a separate resizing step which is unnecessary if the downsizing step after the oversampling would target the final size. i would do it this way, but it's just a clue.
the bests
y
Anonymouses
14th November 2005, 16:53
yep yep ... make some tuning here and there and finally u get ... BDH ;)
Except BDH is much more destructive on details and the black lines in anime then the abcxyz function, so I'll just stick to using the trick function. :) Plus the speed is pretty good as well.
Chainmax
14th November 2005, 20:59
yep yep ... make some tuning here and there and finally u get ... BDH ;)
Your are wrong. Like anonymouses said, abcxyz has much less side-effects than the BDH line.
About Spline16Resize, is it as sharp as Lanczos4? Because if it isn't, then its speed and less likelyhood of creating halos is a moot point for me.
if I'd [manage to] put in the stuff exactly as you all would like, the speed would get very very slow anyway. We're probably talking about utilising median filtering with bigger radii, and such stuff
Like many others in this forum, speed is of no concern. The way I see it, it's better to spend twice the time if that will yield better results, after all you'll be seeing your encodes for far longer the time it took you to encode them. Again, I highly encourage you to make a thread for abcxyz and receive some extensive feedback from fellow Doom9ers. Animated content buffs will love it for sure.
Revgen
14th November 2005, 21:35
There is a lot of good information on dehaloing and ring removal in this thread, unfortunately this a rainbow removal thread.
Perhaps a mod could move all the dehaloing info to a new thread and a new topic.
Chainmax
14th November 2005, 23:01
Good idea, I'm going to email neuron2 and ask him to create a "New halo removers discussion" thread and move all posts from #21 onward to there.
neuron2
15th November 2005, 00:03
Threads split as requested.
Didée
15th November 2005, 13:19
@ Revgen: Sorry for hijacking :o
@ neuron2: Thanks for splitting.
@ all: here's a new plaything :)
The following proof-of-concept function uses a method that I had in mind for a longer time already, but never actually tried it ... because during theorising I always thought "nah, this way it can't work. Well, I should have tried it earlier ... this is probably not the worst Halo remover ever seen :D
Currently, there are the following parameters:
- rx, ry [float, 1.0 ... 2.0 ... ~3.0]
As usual, the radii for halo removal.
Note: this function is rather sensitive to the radius settings. Set it as low as possible! If radius is set too high, it will start missing small spots.
- darkkstr, brightstr [float, 0.0 ... 1.0] [<0.0 and >1.0 possible]
The strength factors for processing dark and bright halos. Default 1.0 both for symmetrical processing. On Comic/Anime, darkstr=0.4~0.8 sometimes might be better ... sometimes. In General, the function seems to preserve dark lines rather good. ;)
- lowsens, highsens [int, 0 ... 50 ... 100]
Sensitivity settings, not that easy to describe them exactly ... in a sense, they define a window between how weak an achieved effect has to be to get fully accepted, and how strong an achieved effect has to be to get fully discarded.
Defaults are 50 and 50 ... try and see for yourself.
- ss [float, 1.0 ... 1.5 ...]
Supersampling factor, to avoid creation of aliasing.
source vs. DeHalo_alpha():
http://img366.imageshack.us/img366/6572/sourceagain6wp.th.png (http://img366.imageshack.us/my.php?image=sourceagain6wp.png) http://img366.imageshack.us/img366/323/dehaloalpha5tr.th.png (http://img366.imageshack.us/my.php?image=dehaloalpha5tr.png)
The function: (needs MaskTools and Repair from the RemoveGrain package)
(edit: forgot to include that small "m4" helper function. It's included now.)
(edit2: an "r" had disappeared, causing parameterless call to deliver a black clip. fixed :o )
function DeHalo_alpha(clip clp, float "rx", float "ry", float "darkstr", float "brightstr", float "lowsens", float "highsens", float "ss")
{
rx = default( rx, 2.0 )
ry = default( ry, 2.0 )
darkstr = default( darkstr, 1.0 )
brightstr = default( brightstr, 1.0 )
lowsens = default( lowsens, 50 )
highsens = default( highsens, 50 )
ss = default( ss, 1.5 )
LOS = string(lowsens)
HIS = string(highsens/100.0)
DRK = string(darkstr)
BRT = string(brightstr)
ox = clp.width()
oy = clp.height()
uv = 1
uv2 = (uv==3) ? 3 : 2
halos = clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1,0)
are = yv12lutxy(clp.expand(U=uv,V=uv),clp.inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
ugly = yv12lutxy(halos.expand(U=uv,V=uv),halos.inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
so = yv12lutxy( ugly, are, "y x - y 0.001 + / 255 * "+LOS+" - y 256 + 512 / "+HIS+" + *" )
lets = maskedmerge(halos,clp,so,U=uv,V=uv)
remove = (ss==1.0) ? clp.repair(lets,1,0)
\ : clp.lanczosresize(m4(ox*ss),m4(oy*ss))
\ .logic(lets.expand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"min",U=uv2,V=uv2)
\ .logic(lets.inpand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"max",U=uv2,V=uv2)
\ .lanczosresize(ox,oy)
them = yv12lutxy(clp,remove,"x y < x x y - "+DRK+" * - x x y - "+BRT+" * - ?",U=2,V=2)
return( them )
}
function m4(float x) {return(x<16?16:int(round(x/4.0)*4))}
Chainmax
15th November 2005, 14:48
At first glance DeHalo_alpha() seems just as good as abcxyz(rad=1.75) but with even a slight better treatment of small details: if you compare the abcxyz(rad1.75) picture Anonymouses posted with the DeHalo_alpha() one in the white beads chain that hold the chandelier, they seem a bit brighter on the DeHalo_alpha() one. Will test this beauty ASAP :).
Dreassica
15th November 2005, 16:57
Someone care to tell me which versiosn of masktools and removegrain i need, cuz i tried liek 3 different ones and all close my script upon loading.
Didée
15th November 2005, 17:11
MaskTools are these (http://manao4.free.fr/MaskTools-v1.5.8.zip) (unless I rebuild the script for MT v2.0aX)
RemoveGrain is not needed, but Repair.dll is. Latest official version should suffice for this one, although using the v1.0 pre-release (http://home.arcor.de/kassandro/RemoveGrain/RemoveGrain.rar) might be a good idea.
Oh, and:
At first glance DeHalo_alpha() seems just as good as abcxyz(rad=1.75) but with even a slight better treatment of small details: if you compare the abcxyz(rad1.75) picture Anonymouses posted with the DeHalo_alpha() one in the white beads chain that hold the chandelier, they seem a bit brighter on the DeHalo_alpha() one.
Yep, from the basic principle alone, this alpha should retain more detail than the abcxyz thingy.
However, when removing halos, there's always some apparent loss of overall contrast ... after all, the sharpening procedure that caused the haloing was not applied with the intention to bug the viewer, but to please him ;)
So, what about adding some minor areabased tralala afterwards?
http://img423.imageshack.us/img423/5281/dehaloalphasmallenhancement3mh.th.png (http://img423.imageshack.us/my.php?image=dehaloalphasmallenhancement3mh.png)
(quickly thrown together, so not tweaked at all.)
Dreassica
15th November 2005, 17:23
thnx, taht worked, but now using plain DeHalo_alpha() in script, i get all black frames.
Didée
15th November 2005, 17:30
thnx, taht worked, but now using plain DeHalo_alpha() in script, i get all black frames.
Nevermind - the halos are gone, aren't they? :D
Seriously: that's interesting! After finishing the function this morning, I also had the case that just a black clip was returned. Searched for an error in the script, but found none ... loaded the script again, and - ba-ding! - everything was fine.
Sorry, no clue ... try again.
edit: wait, something's fishy when defaults are produced. A moment ...
editedit: grrr, an "r" had disappeared somehow, and I didn't see it. ("brightstr" was "brightst"). Fixed. Sorry for being sloppy. :)
Chainmax
15th November 2005, 17:55
Yep, from the basic principle alone, this alpha should retain more detail than the abcxyz thingy.
However, when removing halos, there's always some apparent loss of overall contrast ... after all, the sharpening procedure that caused the haloing was not applied with the intention to bug the viewer, but to please him ;)
So, what about adding some minor areabased tralala afterwards?
http://img423.imageshack.us/img423/5281/dehaloalphasmallenhancement3mh.th.png (http://img423.imageshack.us/my.php?image=dehaloalphasmallenhancement3mh.png)
(quickly thrown together, so not tweaked at all.)
I don't know if I told you before, but You Are The Man!!.
I can't wait to try this one :).
Anonymouses
15th November 2005, 21:44
Didée, thanks for all the work you do and for refining this function more. Even better halo removing then with the original and preserves the small bright areas better.
Here's some more screenshots (especially make note of the eyebrows on the sculpture and the guys fingernails):
Source:
http://img313.imageshack.us/img313/9179/lupinsource4id.png
abcxyz(rad=1.75):
http://img313.imageshack.us/img313/4173/lupinabcxyz8bu.png
DeHalo_alpha():
http://img313.imageshack.us/img313/4651/lupindehaloalpha5tm.png
Wow, I think with this I can finally reauthor this disc without the halos and it preserves a great deal of the detail that BDH was removing.
Anonymouses
15th November 2005, 22:04
And one more example from Trigun again:
Source:
http://img420.imageshack.us/img420/9427/trigunsource0wt.png
abcxyz(rad=1.75):
http://img420.imageshack.us/img420/4391/trigunabcxyz1cs.png
DeHalo_alpha():
http://img420.imageshack.us/img420/3352/trigundehaloalpha2ae.png
Again most noticeable is the small bright areas being preserved especially the tight lines on the kanji credits and the small bright areas on the gun and his hair.
Chainmax
15th November 2005, 22:07
I have some comparisons of my own (from left to right: Source+IVTC, Filtering+HQDering, Filtering+DeHalo_Alpha):
http://img183.imageshack.us/img183/5296/sourceivtc9el.th.png (http://img183.imageshack.us/my.php?image=sourceivtc9el.png)http://img45.imageshack.us/img45/9994/filteringhqderingdehaloing0pr.th.png (http://img45.imageshack.us/my.php?image=filteringhqderingdehaloing0pr.png)http://img45.imageshack.us/img45/5476/filteringdehaloalphadehaloing3.th.png (http://img45.imageshack.us/my.php?image=filteringdehaloalphadehaloing3.png)
Chainmax
15th November 2005, 22:22
One more comparison:
abcxyz:
http://img26.imageshack.us/img26/4501/finalscriptresult24ni.png
DeHalo_Alpha:
http://img485.imageshack.us/img485/239/fubarintro329dehaloalpha0mm.png
The letters look much better, they are bright and white, not yellowish and dull :). Coming up soon: my ultimate test, small detail handling with an X-Men VHS capture.
Chainmax
16th November 2005, 00:05
I pitted DeHalo_Alpha against FixVHSOverSharp in a VHS capture of the X-Men 1992 animated series's pilot intro. DeHalo_Alpha not only does as good a job (maybe even better) at dehaloing, but there's virtually no difference regarding small details. Here are the comparison shots (in all cases, from left to right: Source, Filtering + FixVHSOverSharp, Filtering + DeHalo_Alpha):
http://img498.imageshack.us/img498/3201/armonlefthalosource6nf.th.png (http://img498.imageshack.us/my.php?image=armonlefthalosource6nf.png)http://img498.imageshack.us/img498/4813/armonlefthalofilteringfixvhsov.th.png (http://img498.imageshack.us/my.php?image=armonlefthalofilteringfixvhsov.png)http://img498.imageshack.us/img498/2350/armonlefthalofilteringdehaloal.th.png (http://img498.imageshack.us/my.php?image=armonlefthalofilteringdehaloal.png)
http://img498.imageshack.us/img498/5838/starfieldsource4vg.th.png (http://img498.imageshack.us/my.php?image=starfieldsource4vg.png)http://img458.imageshack.us/img458/9763/starfieldfilteringfixvhsoversh.th.png (http://img458.imageshack.us/my.php?image=starfieldfilteringfixvhsoversh.png)http://img458.imageshack.us/img458/6838/starfieldfilteringdehaloalpha8.th.png (http://img458.imageshack.us/my.php?image=starfieldfilteringdehaloalpha8.png)
http://img458.imageshack.us/img458/5352/whiteeyessource1wu.th.png (http://img458.imageshack.us/my.php?image=whiteeyessource1wu.png)http://img458.imageshack.us/img458/8512/whiteeyesfilteringfixvhsoversh.th.png (http://img458.imageshack.us/my.php?image=whiteeyesfilteringfixvhsoversh.png)http://img499.imageshack.us/img499/640/whiteeyesfilteringdehaloalpha0.th.png (http://img499.imageshack.us/my.php?image=whiteeyesfilteringdehaloalpha0.png)
I'm sold, this is by far the best halo remover I ever tried :) :D :).
foxyshadis
16th November 2005, 00:58
On the simpsons clip it's noticably less sharp. Other comparisons don't show any similar degradation though, maybe it's a fluke, or maybe the filterchain just changed slightly.
Chainmax
16th November 2005, 18:32
I think that the HQDering and DeHalo_Alpha filterchains on the Simpsons screenshots were the same (except for the dehalo method, of course). I'm going to check that again just in case.
SirCanealot
12th December 2005, 22:18
http://www.williams1.homechoice.co.uk/M1.png
http://www.williams1.homechoice.co.uk/M2.png
Frickening awesome!
Thanks, Didée. Maybe I'll repay you in... RAPE DOLLERS... $$$
Chainmax
12th December 2005, 22:27
Good timing, I was just going to make a new post here :).
Didée, would it be possible to include some kind of strength control? From what I can gather on the readme, the strongest setting would be something like DeHalo_Alpha(rx,ry,lowsens=1,highsens=100), but that is not enough on a nasty source (3rd generation VHS captured to DV) I have.
Didée
14th December 2005, 13:01
Mind you, there's a reason for that function being titled "alpha". It's perfectly possible that it just can't cope with your source.
If it's just about mere strength, you can set "darkstr" and "brightstr" to values bigger than 1.0, to force even stronger removal. From some certain point on, it will start doing "over-removal" resulting in strange artefacts, but strengths like 1.1 or 1.2 should be okay. Just try, you'll see when things start going overboard.
Does the source have rather "thick" halos? I noticed that dehalo_alpha has its problems both with very thin and very thick halos. I understand the problem behind, but am still waiting for the sudden inspiration to make a general solution.
Moreover, the settings lowsens and highsens work only "sort of" how they were intended ... don't know what I was thinking when creating the LUT for that. Currently, the consequences of altering these two values are not at all intuitive. This definetly needs a change.
Chainmax
14th December 2005, 13:23
The source has all kinds of halos, it's maybe as f***ed up as the Halo Torture clip I sent you some time ago. I'll try just setting darkstr and brightstr to 1.2 and report back.
Chainmax
14th December 2005, 22:33
Yeah, the halos in that stream are just too strong for DeHalo_Alpha's current state. Here's a comparison:
Source:
http://img406.imageshack.us/img406/756/source4pk.png (http://imageshack.us)
Result:
http://img406.imageshack.us/img406/511/result6pz.png (http://imageshack.us)
Script:
DeDot()
ConvertToYUY2(interlaced=true)
ReYV12()
Interp = SeparateFields().SelectEven().EEDI2(field=0)
TDeint(order=0,field=0,edeint=Interp)
MergeChroma(Crop(0,2,-12,0).AddBorders(12,0,0,2))
Crop(16,4,688,558,align=true)
DeHalo_Alpha(rx=2.5,ry=2.5,darkstr=1.2,brightstr=1.2)
M=DePanEstimate(PixAspect=1.094,Trust=1.0)
R=2
DePanInterleave(Data=M,PixAspect=1.094,Prev=R,Next=R,Mirror=15)
DeGrainMedian(limitY=6,limitUV=8,mode=0)
TemporalSoften(2,0,50,mode=2)
SelectEvery(R+R+1,R)
GaussResize(512,384,p=100)
DeHalo_Alpha(rx=2.5,ry=2.5,darkstr=1.2,brightstr=1.2)
LimitedSharpen(SMode=4,LMode=3,Strength=150,wide=true,soft=75)
The final encode is intended to be 512x384, but for comparison's sake I made the result the same frame size as the source. By the way, is it me or does this have some blending?
krieger2005
15th December 2005, 18:02
Heavy halos... I used my script, which i use for my own encodes and the result is this (no smoother... only my own dehalo-script):
http://img383.imageshack.us/img383/1934/out1bc.png
what do you think?
Chainmax
15th December 2005, 18:25
The result is quite good, could you post your dehalo script?
krieger2005
15th December 2005, 18:40
Don't be shocked. It is frickled and modiefied thorugh the time... And very slow:
function CEA2(clip c, int "EdgeBias"){
EdgeBias = default(EdgeBias,17)
# First remove oversharpened Borders...
c
ConvertToYUY2().FixVHSOversharpL(30,12,8).FixVHSOversharp(30,14,10).ConvertToYV12()
BlindDeHalo3(PPmode=1)
oversharp=last
pT=PreWitt(thin=true)
pT1=FineEdge(EdgeBias)
pT2=pT1.Levels(10,1,110,0,255,false)
FineMask=pT2.Expand().Inpand().Inpand().Inpand().Levels(50,1,160,0,255,false).expand().inflate().inpand()
StrongMask=pT2.Inpand().BilinearResize(m4(width/3.0),m4(height/3.0)).InPand().Expand().BilInearResize(width,height).Expand().Levels(0,1,30,0,255,false)
Fine=YV12LutXY(pT2,FineMask,"y 10 > x 0 ?")
Fine=YV12LutXY(Fine,StrongMask,"y 10 > 0 x ?")
edgeA=pT1
edgeB=edgeA.Levels(30,1,90,0,255,false)
edgeC=edgeB.BilinearResize(m4(width()/4),m4(height()/4)).expand().inflate().BilinearResize(width(),height())
ptTMP=YV12LutXY(pt,edgeA,"x 10 > y 40 > & x 0 ?")
edgeD=YV12LUTxy(edgeC,ptTMP,"y 0 > x 10 > & 0 x 1.3 * ?")
edgeE1=YV12LUTxy(edgeD,Fine,"y 0 > x 20 > & x y 1.3 * - x ?").deflate()
edgeE1=edgeE1.Levels(0,1,150,0,255,false).inflate()
edgeE2=YV12LutXY(ptTMP.inflate(),Fine,"y 0 > x 20 > & x y 1.3 * - x ?").inflate()
edgeE3=YV12LutXY(edgeB,FineMask,"y 10 < x 0 ?").inflate
# Now the Cleaning
# Attention: Cleaning of c, not oversharpened
c
# Clean The Edges
clean=Deflate().Inflate().BlindDeRingA(5,5,2,20,true,false,false)
clean=clean.Blockbuster(method="noise", detail_min=1, detail_max=32, mean=1, variance=2)
MaskedMerge(clean,EdgeE1,Y=3,V=1,U=1)
clean=last
clean=clean.UnSharpMask(250,1,0)
clean=clean.Blur(.2)
MaskedMerge(clean,edgeE2,Y=3,V=1,U=1)
anti=GetAntialiaseClip()
MaskedMerge(anti,edgeE3,Y=3,V=1,U=1)
#MaskedMerge(UnSharpMask(50,1,0),FineMask,Y=3,V=1,U=1)
}
function GetAntialiaseClip(clip c, bool "chroma"){
chroma = default(chroma,false)
faktor = 1.7
SangOrder=0
SangFakt1=90
SangFakt2=90
X=width(c)
Y=height(c)
Lanczos4Resize(c,m4(X*faktor),m4(Y*faktor))
TurnLeft().SangNom(SangOrder,SangFakt1)
TurnRight().SangNom(SangOrder,SangFakt2)
BilinearResize(X,Y)
sangnommed=last
chroma ? MergeChroma(c) : sangnommed
return last
}
I uses several filters: Fixoversharp, BlindDehalo, Sangnom,Masktools, FineEdge, BlindDeRing. BlindDering is a filter which i coded by myself. You can get it here: link (http://rapidshare.de/files/9226278/BlindDeRing.dll.html). Here i wrote abouth this filter: forum-link (http://forum.doom9.org/showthread.php?t=92684)
The general purpose is to build up a mask on a dehalod picture and use this mask to dehalo it with "blinddering". I tried to make here something like "don't remove-things, which are too file". General purpose is that even halos can't be removed blind when there are too many detail. So why should we try it?
Also look at "edgeC". This can be interpreted as "clean-radius". Bigger Value-> Bigger Radius. Till now i modified it for every movie individually.
maybe there is someone out there who can optimize this script.
BTW: It try also to antialliase (secure).
Chainmax
15th December 2005, 20:18
You should replace BlindDeHalo with DeHalo_Alpha, it's much better.
FredThompson
2nd January 2006, 01:38
The letters look much better, they are bright and white, not yellowish and dull :). Coming up soon: my ultimate test, small detail handling with an X-Men VHS capture.What happened to the source frame?
HOLiC
31st January 2006, 01:36
is there dehalo_alpha version for masktools 2.0?
Chainmax
31st January 2006, 01:43
FredThompson, what do you mean?
HOLiC, not for now, but a modification is probably easy to do, just ask Didée if he has the time do it.
FredThompson
31st January 2006, 02:09
There was a broken link in an earlier post. Your source frame wasn't showing or you'd forgotten to add it to the post or something like that.
foxyshadis
31st January 2006, 05:46
function DeHalo_alpha(clip clp, float "rx", float "ry", float "darkstr", float "brightstr", float "lowsens", float "highsens", float "ss")
{
rx = default( rx, 2.0 )
ry = default( ry, 2.0 )
darkstr = default( darkstr, 1.0 )
brightstr = default( brightstr, 1.0 )
lowsens = default( lowsens, 50 )
highsens = default( highsens, 50 )
ss = default( ss, 1.5 )
LOS = string(lowsens)
HIS = string(highsens/100.0)
DRK = string(darkstr)
BRT = string(brightstr)
ox = clp.width()
oy = clp.height()
uv = 1
uv2 = (uv==3) ? 3 : 2
halos = clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1,0)
are = mt_lutxy(clp.mt_expand(U=uv,V=uv),clp.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
ugly = mt_lutxy(halos.mt_expand(U=uv,V=uv),halos.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
so = mt_lutxy( ugly, are, "y x - y 0.001 + / 255 * "+LOS+" - y 256 + 512 / "+HIS+" + *" )
lets = mt_merge(halos,clp,so,U=uv,V=uv)
remove = (ss==1.0) ? clp.repair(lets,1,0)
\ : clp.lanczosresize(m4(ox*ss),m4(oy*ss))
\ .mt_logic(lets.mt_expand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"min",U=uv2,V=uv2)
\ .mt_logic(lets.mt_inpand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"max",U=uv2,V=uv2)
\ .lanczosresize(ox,oy)
them = mt_lutxy(clp,remove,"x y < x x y - "+DRK+" * - x x y - "+BRT+" * - ?",U=2,V=2)
return( them )
}
function m4(float x) {return(x<16?16:int(round(x/4.0)*4))}
Standard disclaimer: May show gigantic bugs in masktools 2. Always use the latest alpha and always compare to the original.
If my mod starts showing results I'll post it too; right now it's not that much better. Don't work on it much though.
HOLiC
31st January 2006, 06:05
thanks chainmax! and thank you foxyshadis!!
I can't wait to try this version...^^
Lil' Jer
31st January 2006, 09:16
Standard disclaimer: May show gigantic bugs in masktools 2. Always use the latest alpha and always compare to the original.
If my mod starts showing results I'll post it too; right now it's not that much better. Don't work on it much though.
Seems to give identical results. From Porco Rosso R2 version:
Source:
http://img464.imageshack.us/img464/2964/source1gk.png
DeHalo_Alpha(darkstr=.4) (old version):
http://img96.imageshack.us/img96/9749/dehaloold9eg.png
DeHalo_Alpha(darkstr=.4) (Masktools 2):
http://img96.imageshack.us/img96/3904/dehalonew6uw.png
gatekeeper_007
30th April 2006, 23:42
1st I'd like to say: Keep up the good work !
and then I'd like to ask a silly question...
well, sometimes I like to over do it with the compression
and as a result of that I get some film alterations__which I'm able to get rid of at the cost of very little detail-loss.
The only thing I can't get rid of (without a greater-loss of detail) is some mosquito noise which is the result of that low bitrate.
My question is:
I know//at least I think I do.... that 'BlindDehalo3' and 'Dehalo_alpha' are made so they can be used to correct some things in a (source), but I was wonderin' how stupid will it be to use something like PPmode=-1 or -2 on a clean source to correct my issue?
thx
NO I wont give higher bitrates:D
techmule
11th August 2006, 11:22
Any updates to the dehalo scripts.(both earlier and MVtool2 vers) ???
frednerk33
26th August 2006, 02:57
Seconding that... any updates or new approaches ? Guess could zip over to the Dev forum but haven't spotted anything in an occasional browse.
MaXi_TK96
28th August 2006, 16:15
Don't forget that this filter can also remove haloing caused by some sharpener filters so that is one more use for this filter. Dunno if FFDshow has this kind of a filter but I could image it would be very handy. Many thanx to the Didee and foxyshadis for their work!
Chainmax
28th August 2006, 21:23
IIRC, Didée is was very busy with other projects (Restore24 being one of them) and hadn't thought of further improvements. What I'd like to see is a renewed version of HQDering as requested in this thread (http://forum.doom9.org/showthread.php?t=110639). That or a standalone version of IIP's deringing.
FredThompson
6th September 2006, 21:34
where does the function "expand" live? I've updated a bunch of filters and this seems to have disappeared. I'm starting to wonder if AviSynth has a limit on the number of filters it will auto-load. warpsharp is pretty far down the alphabetical sort...
foxyshadis
7th September 2006, 00:51
2.5.6 does have a limit (a bug, really), and that's one reason I keep filters split between an auto and manual load folder. 2.5.7 has no such limit.
Expand is part of masktools 1.x.
FredThompson
7th September 2006, 04:51
2.5.7a3 dates back to April. Is the alpha aspect only additional things which aren't in 2.5.6?
Mug Funky
7th September 2006, 06:40
i noticed some analog captures will have haloes that ring for a while (much longer than dehalo_alpha can handle).
here's my solution to one particular video (might post a screen later):
fliphorizontal()
mt_convolution(horizontal="0 0 0 0 0 0 0 0 0 0 0 0 0 -2 -2 -2 -3 1 -3 125 -10 17 -1 -11 -1 7 1 -2 1 2 1 0 0 1 1 1",vertical="1",y=3,u=2,v=2)
fliphorizontal()
the matrix was figured out by strongly (mocomped temporal) denoising and choosing a part that is "impulse like" - a black outline with grey either side of it.
then i took it into photoshop, inverted it (so the "impulse" points upward), highpassed it so it sat about 128, then copied it to a new layer, inverted it (so at 50% it cancels out to grey), then mixed the result of that with grey, and manually added a white bit that would allow the original picture through...
it's a poor man's deconvolution basically. the downside is it's a lot of tweaking and no guarantee of an improvement, but i found it killed almost all the ringing and what was left was easily handled by dehalo_alpha...
if you run the above filter on clean video you'll get an idea of what the original looked like :)
Chainmax
9th September 2006, 08:12
2.5.6 does have a limit (a bug, really), and that's one reason I keep filters split between an auto and manual load folder. 2.5.7 has no such limit.
...
Really? What would be a ballpark figure of that limit?
foxyshadis
9th September 2006, 08:57
http://forum.doom9.org/showthread.php?p=800876#post800876
FredThompson
9th September 2006, 21:14
I've moved to the 2.5.7alpha build. Can't seem to find anything that will verify if the "older" aspects are untouched. IOW, are the only parts which are actually alpha new additions and how they "join the club"? Nothing I've done so far has broken.
canuckerfan
13th November 2006, 09:50
curious to know if this script is still being developed. its probably the best dehalo around.
Chainmax
13th November 2006, 14:31
It is indeed. Still, I'd love to see a sped-up version of HQDering with softmasking.
canuckerfan
15th March 2007, 21:02
any possible speed-ups to this script?
anton_foy
25th April 2007, 02:19
Would it be possible to use Dehalo_alpha over speciefied ranges?
Many of my scenes have a candle or a lightbulb with a dark black contour around them.
Maybe to use (radius=5, min=229, max=255) to only making Dehalo_Alpha active over these ranges(plus a radius to expand the area a bit). I think this feature would be great.
*.mp4 guy
25th April 2007, 05:19
mp1 = yv12lutxy(last, last, "x 229 - 255 *", u=3, v=3)
mp2 = mp1.expand.expand.expand.expand.expand
mp3 = yv12lutxy(mp1, mp2, "y x -", u=3, v=3)
maskedmerge(last, dehalo_alpha(last, rx=5, ry=5), mp3)
That should do it, It could probably be spead up a bit, but this should be reasonably fast, so I'm not going to bother looking for little speed ups.
anton_foy
25th April 2007, 13:36
Thank You *.mp4 Guy!
It works really, though it won't reduce the black contour enough but maybe Dehalo_Alpha wasn't the right filter for this task from the beginning. Anyway it does some good and for the more subtle lights it's perfect.
Alain2
23rd June 2007, 17:34
i noticed some analog captures will have haloes that ring for a while (much longer than dehalo_alpha can handle).
here's my solution to one particular video (might post a screen later):
fliphorizontal()
mt_convolution(horizontal="0 0 0 0 0 0 0 0 0 0 0 0 0 -2 -2 -2 -3 1 -3 125 -10 17 -1 -11 -1 7 1 -2 1 2 1 0 0 1 1 1",vertical="1",y=3,u=2,v=2)
fliphorizontal()
the matrix was figured out by strongly (mocomped temporal) denoising and choosing a part that is "impulse like" - a black outline with grey either side of it.
then i took it into photoshop, inverted it (so the "impulse" points upward), highpassed it so it sat about 128, then copied it to a new layer, inverted it (so at 50% it cancels out to grey), then mixed the result of that with grey, and manually added a white bit that would allow the original picture through...
it's a poor man's deconvolution basically. the downside is it's a lot of tweaking and no guarantee of an improvement, but i found it killed almost all the ringing and what was left was easily handled by dehalo_alpha...
if you run the above filter on clean video you'll get an idea of what the original looked like :)
I had a look at the result and this seems indeed to be an effective script for some video even if it's manual tweaking. However I have a hard time to follow the steps you describe to find how to set the convolution parameters.. When you have some free time, would you mind making some screenshots of all the steps you describe in photoshop ?
Thanks :)
Alain2
6th September 2008, 15:42
Up... Anyone to explain a bit / link to some explanation ?
McCauley
1st February 2009, 22:50
Added DeHalo_alpha to the wiki (http://avisynth.org/mediawiki/DeHalo_alpha).
Feel free to refine it.
Regards
McCauley
msaadn
23rd June 2009, 18:13
I'm having trouble with DeHalo_alpha. It says There is no function named "expand". Line 21. I downloaded the script from the wiki.
EDIT: Never mind. I fixed it myself.
flebber
3rd January 2010, 06:08
I'm having trouble with DeHalo_alpha. It says There is no function named "expand". Line 21. I downloaded the script from the wiki.
EDIT: Never mind. I fixed it myself.
Whats the solution I have the same error, is it a different version of MT.dll?
msaadn
3rd January 2010, 15:13
Whats the solution I have the same error, is it a different version of MT.dll?
I replaced that line in the script.
Replace this:
are = yv12lutxy(clp.expand(U=uv,V=uv),clp.inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
With this:
are = mt_lutxy(clp.mt_expand(U=uv,V=uv),clp.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
Since it was a long time ago I don't remember if I made any more changes. Just give it a try.
Didée
3rd January 2010, 16:20
If you step one page back in this thread, there is a MaskToolsV2 version of dehalo_alpha (http://forum.doom9.org/showpost.php?p=777956&postcount=70) to be found ...
flebber
3rd January 2010, 23:06
I replaced that line in the script.
Replace this:
are = yv12lutxy(clp.expand(U=uv,V=uv),clp.inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
With this:
are = mt_lutxy(clp.mt_expand(U=uv,V=uv),clp.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
Since it was a long time ago I don't remember if I made any more changes. Just give it a try.
Thanks and that "mt_lutxy" will also solve the error I got with the avcxyz script. Which errored at yv12lutxy when I tried to run it. Thanks for the link Didee
the_provider
25th April 2010, 23:38
Greetings.
I have some old movies(on DVD) that shows something I would describe as halo(attached: shadows.PNG, White_halo.jpg).
Since I am not sure whether it is the same halo that makes the subject for this posting I attached some photos hoping that you can put me on the right track.
Questions:
1. what would be more suitable for a movie, DeHalo_Alpha or BlindDeHalo3_mt2?
2. Any recommendation for parameters?
3. I tried to use the beneath script that returned an error from VD(1.9.9):
__________________
# PLUGINS
LoadPlugin("C:\Software\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\Downloads\BitComet\VirtualDub-1.9.9\plugins\Repair.dll")
LoadPlugin("C:\Downloads\BitComet\VirtualDub-1.9.9\plugins\RemoveGrain.dll")
LoadPlugin("C:\Downloads\BitComet\VirtualDub-1.9.9\plugins\mt_masktools-25.dll")
Import("C:\Documents and Settings\Catalin\My Documents\Video_related\BlindDeHalo3_mt2.avs")
LoadPlugin("C:\Software\GORDIA~1\AviSynthPlugins\UnDot.dll")
# SOURCE
mpeg2source("C:\BitComet_Download\BurebistaDVD\VIDEO_TS\Burebista1.d2v")
BlindDeHalo3()
# CROPPING
crop(2,20,716,536)
# RESIZING
LanczosResize(720,368)
# DENOISING: choose one combination (or none)
Undot()
mergechroma(blur(1.3))
#FluxSmoothST(5,7)
__________________
The picture with error is attached(DeHalo_Script_Error.PNG).
What seems to be the problem?
4. I also attached some samples of the video. What you see has been passed through a chain of 4 MSU filters(OldColorRestoration, SmartBrightness, DeNoiser, Sharpen) but the original(original.jpg) has the same halo, of course with worse colors, too.
The BIG question is: is DeHalo what I am after or there is another filter(s) I should look after?
5. Is there a gallery of picture for video errors available? I still have trouble identifying spatial from temporal noise, to say the least of my lack of knowledges...
Thank you in advance.
Best regards.
the_provider
26th April 2010, 22:00
No advice whatsoever?
Please?...
flebber
27th April 2010, 04:15
No advice whatsoever?
Please?...
your photos are pending approval, upload to flickr or whatever and post photo's in so people can instantly view.
the_provider
27th April 2010, 12:29
your photos are pending approval, upload to flickr or whatever and post photo's in so people can instantly view.
I can see them so I guess everybody else can see them, too.
I have them on flickr now but for some reason I couldn't make the appear here(I used the Insert photo button with no visible result), here is an example: http://www.flickr.com/photos/49747562@N08/4557549414/
Thank you in advance.
Best regards.
flebber
27th April 2010, 16:39
Well definitely try dehalo_alpha.
Maybe
FFT3dGPU(sigma=3.0, plane=4, bt=0,sharpen=1, bw=32, bh=32)
DeHalo_alpha()
LSFmod(defaults="slow")
You could always try fft3dfilter instead of the GPU version, dfftest does a good job but can be a little slow for me.
Or even
MCTemporalDenoise(edgeclean=true, ecrad=4, stabilize=true, maxr=2)
DeHalo_alpha()
LSFmod(defaults="slow")
Lyris
27th April 2010, 16:45
The first image appears to be an optical halo. I've seen this on a lot of older flying spot scanner transfers, the white areas "glow".
I don't think dehalo filters will work for that.
The second image looks like it's been camcorded from a TV set? It has optical glowing AND an electronic halo (smaller darker line). The halo remover would likely get rid of the thick black line, but not the white light spilling over the boundary.
The third one is entirely electronic, but it looks like all of the detail in this image is confined to the middle frequencies. Removing the halos is likely to be of limited success.
the_provider
27th April 2010, 23:45
First I would like to thank everybody who take the time to reply.
Well definitely try dehalo_alpha.
I would like to do that, too but I keep getting the same error:
Error reading source frame 0: Avisynth read error: CAVIStreamSynth: System exception - Acces violation...
I use the following script:
LoadPlugin("C:\Software\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\Downloads\BitComet\VirtualDub-1.9.9\plugins\Repair.dll")
LoadPlugin("C:\Downloads\BitComet\VirtualDub-1.9.9\plugins\RemoveGrain.dll")
LoadPlugin("C:\Downloads\BitComet\VirtualDub-1.9.9\plugins\mt_masktools-25.dll")
Import("C:\Documents and Settings\Catalin\My Documents\Video_related\BlindDeHalo3_mt2.avs")
LoadPlugin("C:\Software\GORDIA~1\AviSynthPlugins\UnDot.dll")
# SOURCE
mpeg2source("C:\BitComet_Download\BurebistaDVD\VIDEO_TS\Burebista1.d2v")
#Version()
ConvertToYV12()
BlindDeHalo3()
# CROPPING
crop(2,20,716,536)
# RESIZING
LanczosResize(720,368)
# DENOISING: choose one combination (or none)
Undot()
where BlindDeHalo3_mt2.avs(I have a core 2 duo processor) contains:
function BlindDeHalo3( clip clp, float "rx", float "ry", int "strength",
\ float "lodamp", float "hidamp", float "sharpness", float "tweaker",
\ int "PPmode", int "PPlimit", bool "interlaced")
{
rx = default( rx, 3.0 )
ry = default( ry, 3.0 )
strength = default( strength, 125 )
lodamp = default( lodamp, 0.0 )
hidamp = default( hidamp, 0.0 )
sharpness = default( sharpness, 0.0 )
tweaker = default( tweaker, 0.0 )
PPmode = default( PPmode, 0 )
PPlimit = default( PPlimit, (abs(PPmode)==3) ? 4 : 0 )
interlaced = default( interlaced, false )
sharpness = (sharpness>1.58) ? 1.58 : sharpness
tweaker = (tweaker > 1.00) ? 1.00 : tweaker
strength = float(strength)*(1.0+sharpness*0.25)
RR = string((rx+ry)/2.0)
ST = string(float(strength)/100.0)
LD = string(lodamp)
HD = string(pow(hidamp,2))
TWK0 = "x y - 12 "+ST+" / "+RR+" / /"
TWK = "x y - 12 "+ST+" / "+RR+" / / abs"
TWK_HLIGHT = "x y - abs 1 < 128 "+TWK+" 128 "+TWK+" - "+TWK+" 128 / * + "+TWK0+" "+TWK+" "+LD+" + / * "
\ + "128 "+TWK+" - 20 / 2 ^ 128 "+TWK+" - 20 / 2 ^ "+HD+" + / * 128 + ?"
i = (interlaced==false) ? clp : clp.separatefields()
oxi = i.width
oyi = i.height
sm = i.bicubicresize(m4(oxi/rx),m4(oyi/ry))
mm = mt_lutxy(sm.mt_expand(),sm.mt_inpand(),"x y - 4 *").mt_expand().mt_deflate().blur(1.58).mt_inflate().bicubicresize(oxi,oyi,1.0,.0).mt_inflate()
sm = sm.bicubicresize(oxi,oyi,1.0,.0)
smd = mt_lutxy(i.sharpen(tweaker),sm,TWK_HLIGHT)
smd = (sharpness==0.0) ? smd : smd.blur(sharpness)
clean = mt_lutxy(i,smd,yexpr="x y 128 - -").mergechroma(i)
clean = mt_merge(i,clean,mm)
LL = string(PPlimit)
LIM = "x "+LL+" + y < x "+LL+" + x "+LL+" - y > x "+LL+" - y ? ?"
base = (PPmode<0) ? i : clean
small = base .bicubicresize(m4(oxi/sqrt(rx*1.5)),m4(oyi/sqrt(ry*1.5)))
ex1 = small.mt_expand().blur(.5)
in1 = small.mt_inpand().blur(.5)
hull = mt_logic( mt_lutxy( ex1.mt_expand().RemoveGrain(12,-1), ex1, "x y - 1 1 / * 1.0 ^ 1 - 5 *" )
\ ,mt_lutxy( in1, in1.mt_inpand().RemoveGrain(12,-1), "x y - 1 1 / * 1.0 ^ 1 - 5 *" )
\ ,"max", U=-128, V=-128)
\ .bicubicresize(oxi,oyi,1.0,.0)
postclean = (abs(PPmode)== 1) ? mt_merge(base,small.bicubicresize(oxi,oyi,1.0,.0),hull,Y=3,U=2,V=2)
\ : (abs(PPmode)== 2) ? mt_merge(base,base.RemoveGrain(19,-1),hull,Y=3,U=2,V=2)
\ : (abs(PPmode)== 3) ? mt_merge(base,base.RemoveGrain(4,-1),hull,Y=3,U=2,V=2)
\ : clean
postclean = (PPlimit==0) ? postclean
\ : mt_lutxy(base,postclean,yexpr=LIM,U=2,V=2)
(PPmode==0) ? clean : postclean
interlaced ? weave() : last
return( last )
}
#---------------------------------------------------------
function m4(float x) {return(x<16?16:int(round(x/4.0))*4)}
OR
DeHalo_alpha, of course with the proper change in the Import command in my script:
function DeHalo_alpha(clip clp, float "rx", float "ry", float "darkstr", float "brightstr", float "lowsens", float "highsens", float "ss")
{
rx = default( rx, 2.0 )
ry = default( ry, 2.0 )
darkstr = default( darkstr, 1.0 )
brightstr = default( brightstr, 1.0 )
lowsens = default( lowsens, 50 )
highsens = default( highsens, 50 )
ss = default( ss, 1.5 )
LOS = string(lowsens)
HIS = string(highsens/100.0)
DRK = string(darkstr)
BRT = string(brightstr)
ox = clp.width()
oy = clp.height()
uv = 1
uv2 = (uv==3) ? 3 : 2
halos = clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1,0)
are = mt_lutxy(clp.mt_expand(U=uv,V=uv),clp.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
ugly = mt_lutxy(halos.mt_expand(U=uv,V=uv),halos.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
so = mt_lutxy( ugly, are, "y x - y 0.001 + / 255 * "+LOS+" - y 256 + 512 / "+HIS+" + *" )
lets = mt_merge(halos,clp,so,U=uv,V=uv)
remove = (ss==1.0) ? clp.repair(lets,1,0)
\ : clp.lanczosresize(m4(ox*ss),m4(oy*ss))
\ .mt_logic(lets.mt_expand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"min",U=uv2,V=uv2)
\ .mt_logic(lets.mt_inpand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"max",U=uv2,V=uv2)
\ .lanczosresize(ox,oy)
them = mt_lutxy(clp,remove,"x y < x x y - "+DRK+" * - x x y - "+BRT+" * - ?",U=2,V=2)
return( them )
}
function m4(float x) {return(x<16?16:int(round(x/4.0)*4))}
Any other way of using DeHalo?
I am using Avisynth 2.6
Thank you in advance.
Gavino
27th April 2010, 23:53
LoadPlugin("C:\Downloads\BitComet\VirtualDub-1.9.9\plugins\mt_masktools-25.dll")
...
I am using Avisynth 2.6
Then you should be using mt_masktools-26.dll
the_provider
29th April 2010, 09:51
Then you should be using mt_masktools-26.dll
Thank you for the tip, the script works now.
I will see if it helps with restoring my video, too, and get back with results.
Best regards.
I wonder if with BlindDeHalo can keep dark areas, as with the DeHalo_alpha acting on darkstr=0.0
add a VMToon not convinced me
:thanks:
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.