View Full Version : How To Apply Vertical-Only Sharpen Filter
dimzon
20th June 2005, 06:54
How To Apply Vertical-Only Sharpen Filter?
Thanx!
Mug Funky
20th June 2005, 07:39
simplest way is sharpen(0,1) or blur(0,-1)
i'd like to see limitedsharpen modded to allow sharpening x and y seperately, but i'm too lazy to do it myself right now :)
Didée
20th June 2005, 08:58
Regarding LimitedSharpen: Sharpening X and Y seperately is not the problem. It's the limiting that's hard to do in a "correct" way, then:
...
bright_limit_full = blah.expand
dark_limit_full = blah.inpand
bright_limitX = blah.logic(yv12convolution("1 0 0"),"max").logic(yv12convolution("0 0 1"),"max"
dark_limitX = blah.logic(yv12convolution("1 0 0"),"min").logic(yv12convolution("0 0 1"),"min"
[same for bright_limitY and dark_limitY]
[weighted average of bright_limit_full/bright_limitX/bright_limitY and dark_limit_full/dark_limitX/dark_limitY, acc. to X/Y sharpening ratio]
...
Something like that. You can imagine this would get very slow, just for the darn limiting.
If it's okay to sharpen seperately (but for Smode=2 only), but still limit by the minima/maxima of the full 3x3 neighbourhood, then it's easy (http://home.arcor.de/dhanselmann/_stuff/LimitedSharpen_(sharpXYforMugFunky).rar) : just call LS with (Smode=2, strengthX=0..100, strengthY=0..100)
Mug Funky
20th June 2005, 09:07
ah yeah, forgot about the limiting thing. shouldn't make a big difference though. perhaps manao can help :)
horizontal-only sharpening is a very useful thing for TV stuff - vertical sharpening just makes interlaced CRTs flicker like mad, but horizontal sharpening can really help things if they're from an old source.
bond
20th June 2005, 09:19
unfilter?
Didée
20th June 2005, 10:08
Sure, unfilter also.
BTW, we don't have an UnsharpMask filter allowing independant radii for x and y, no?
# approximated UnsharpMask, usually precise enough
# independant radii for x & y possible ;)
#
# equal sharpening: e.g. USMxy(3.0, strength=100, chroma=false)
# independant: e.g. USMxy(0, rx=3.0, ry=1.5, 150, false)
#
# chroma sharpening possible, but usually not recommended.
#
# Requires MaskTools.
function USMxy(clip clp, float "r", float "rx", float "ry", float "strength", bool "chroma")
{
strength = default(strength, 100.0)
r = default(r, 2.0)
rx = default(rx, r)
ry = default(ry, r)
chroma = default(chroma, false)
ox = clp.width
oy = clp.height
uv = chroma ? 3 : 2
STR = string(strength/100.0)
yv12lutxy( clp, clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1.0,.0),
\ "x x y - "+STR+" * +","x x y - "+STR+" * +","x x y - "+STR+" * +",U=uv,V=uv)
}
#----------
function m4(float x) {return(x<16?16:int(round(x/4.0))*4)}
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.