View Full Version : Using sharpening filters vertically only.
anton_foy
30th June 2007, 14:41
Is there an easy way to use other sharpeners the same way LimitedSharpen works? Like LimitedSharpen2(ss_x=0 , ss_y=1.0)
I want to sharpen with asharp (maybe also awarpsharp) a little more on the vertical than horizontally.
foxyshadis
30th June 2007, 17:20
For any sharpeners that don't have separate h/v controls, you can use supersampling - the larger the SS on an axis, the weaker the effect. (Your example would actually be an infinite horizontal sharpening, if such a thing was possible.) So something like:
Spline36Resize(width*2,height).aSharp(20).Spline36Resize(width,height)
Should halve the sharpening effect along the x axis. (It'll also be half the speed, unfortunately.)
Didée
30th June 2007, 21:07
Another possibility (also to be found in LimitedSharpen;)): cancelling of sharpening on one axis.
source = whatever
sharp = source.aSharp.aWarpSharp # or whatever sharpening you're using
sharp_diff = mt_makediff(source,sharp)
sharp_diff_hblur = sharp_diff.blur(1,0) # .blur(1.58,0)
sharp_diff_hreduced = mt_lutxy(sharp_diff,sharp_diff_hblur,
\ "x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?")
source.mt_makediff(sharp_diff_hreduced,U=2,V=2)
The reduction is controlled by the line with 'blur(x,0)': e.g. blur(0.2,0) will only slightly reduce the horizontal sharpening, or 'blur(1.0).blur(1.58,0)' will remove very much of the horizontal sharpening.
This reduction method doesn't need to do the upscale & the downscale, and doesn't force the sharpener to work on a larger image area. In exchange, two makediff's, a lutxy and a blurring operation have to be done (get the difference, modify the difference, apply the modified difference).
Wether this is faster than the supersampling method or not, depends on how much supersampling you would need, and on how fast or slow the used sharpeners are.
For a radius R sharpener this should negate the effect.R=1 # Radius
F=R*2+1
BilinearResize(width*F,height).aSharp(20).PointResize(width,height,R,0,width*F,height)The PointResize is set up to pick the middle pixel from the expanded group.
anton_foy
6th July 2007, 21:05
Thank you and excuse me for the late reply.
I think Didée's function worked best but IanB's looked great though a problem occured. The spots where the whites are clipped(I know they should'nt be:rolleyes:) it shows a part from the image a few pixels lower resulting in dark spots in the whites.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.