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

Thread Tools Search this Thread Display Modes
Old 14th January 2012, 13:36   #1  |  Link
Registered User
Join Date: Nov 2010
Posts: 11
Dehalo on text

There are several instances of pretty blatant halos around text (mostly credits, but some text creeps up throughout the episodes too) in this source (there is some haloing on other parts of the source, but nothing as blatant, nor would I suspect as easy to fix, so for now I'm just focusing on the text):
Halo: http://i.imgur.com/PZwer.png
Blurred: http://i.imgur.com/Mm6oL.png

The second image is a simple blur(1.2) which does a better job at hiding the halos than any of the various dehalo filters I found lying around, but of course it destroys a lot of detail in more complicated scenes, and even on some of the kanji themselves. I tried preventing the more detailed parts of scenes, and scenes without text from being affected by throwing together a quick mask, but I don't really (obviously) have much experience trying to mask things off:
halod = last
dhalod = halod.blur(1.2)
mask = halod.mt_edge(mode="laplace", thY1=30, thY2=30).averageblur(radY=5).mt_binarize(0)
mt_merge(halod, dhalod, mask)
The result of this is pretty good for my purposes. The idea is that this will find the places with really high luma differences (white text on dark background), expand the area to include the halos, and replace that portion with the blurred portion.

Besides blurring the kanji (since I couldn't really think of a good way to expand just the edges of the mask) it doesn't take into account changes to the mask over time so sometimes as the background moves behind the text, portions of the text will flicker between halo'd and blurred.

So I was wondering if anyone could think of some ways to improve on this idea. Basically better ways to detect the white text, expand the edges of the mask so it covers just the halos, and prevent the mask from popping in and out.

Last edited by mikewando; 14th January 2012 at 13:43.
mikewando is offline   Reply With Quote
Old 21st January 2012, 17:02   #2  |  Link
Big Bit Savings Now !
Emulgator's Avatar
Join Date: Feb 2007
Location: close to the wall
Posts: 1,598
What if you try DeHalo_alpha() and sharpen back afterwards ?
This is what I use sometimes.

You got to vary rx and ry to fit your source of course.

#   --------------------------------------------Start of DeHaloing------------------------------
#BlindDeHalo3(rx=3.2,ry=1.5) # or
DeHalo_alpha(rx=3.0, ry=2.5, darkstr=1.2, brightstr=1.0, lowsens=50, highsens=50)#gets rid of medium sharpening halos
#   ---------------------------------
#   function DeHalo_alpha(clip clp, float "rx", float "ry", float "darkstr", float "brightstr", float "lowsens", float "highsens", float "ss")
#   rx = default( rx, 2.0 )#xradius for Halo removal 1.0...2.0...3.0 Set as low as possible. If set too high, it will start missing small spots.
#   ry = default( ry, 2.0 )#yradius for Halo removal 1.0...2.0...3.0 Set as low as possible. If set too high, it will start missing small spots.
#   darkstr = default( darkstr, 1.0 )#0.0..1.0 The strength factors for processing dark and bright halos. Default 1.0 both for symmetrical processing. <0.0 and >1.0 possible.
#   brightstr = default( brightstr, 1.0 )#0.0..1.0 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 = default( lowsens, 50 )#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
#   highsens = default( highsens, 50 )#0..50..100 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 = default( ss, 1.5 )#1.0..1.5..Supersampling factor, to avoid creation of aliasing.
#   --------------------------------------------End of DeHaloing--------------------------------
Followed by one of these sharpeners:
LSFmod (moderate and nice)
SSSharp2 (slow and more ringing, but sometimes very helpful, depending on nature of source)
MedSharp2(veryslow, but awesome)
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."
Emulgator is offline   Reply With Quote

dehalo, masks, text

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 14:46.

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